DNN4.5.5在性能方面应该做了不少工作,上面hostsetting页面的关于性能方面的设置在DNN3X(至少在我比较熟悉的4.3.5)中是没有的.
1.Page State Persistence,我不知道怎么翻译,但我知道他有什么作用.就是将页面的ViewState保存于页面,或内存.如果选page项,那就是asp.net默认的方法保存于页面中,如果选内存,它就保存于内存.我们会发现
<input type="hidden" name="__VIEWSTATE" id="
__VIEWSTATE" value="" />
也就是说页面的ViewState是空的.
2.模块缓存方法 (还没看过代码实现,待学习,以后补上)
3.运行设置
ModuleController.vb
Dim key As String = String.Format(DataCache.TabModuleCacheKey, TabId)
'First Check the Tab Cache
Dim modules As Dictionary(Of Integer, ModuleInfo) = TryCast(DataCache.GetPersistentCacheItem(key, GetType(Dictionary(Of Integer, ModuleInfo))), Dictionary(Of Integer, ModuleInfo))
If modules Is Nothing Then
'tabmodule caching settings
Dim timeOut As Int32 = DataCache.TabModuleCacheTimeOut * Convert.ToInt32(Common.Globals.PerformanceSetting)
'Get modules form Database
modules = FillModuleInfoDictionary(DataProvider.Instance().GetTabModules(TabId))
'Cache tabs
If timeOut > 0 Then
DataCache.SetCache(key, modules, TimeSpan.FromMinutes(timeOut), True)
End If
End If
Return modules
End Function
TabController.vb
Dim key As String = String.Format(DataCache.TabCacheKey, PortalId)
'First Check the Tab Cache
Dim tabs As Dictionary(Of Integer, TabInfo) = TryCast(DataCache.GetPersistentCacheItem(key, GetType(Dictionary(Of Integer, TabInfo))), Dictionary(Of Integer, TabInfo))
If tabs Is Nothing Then
'tab caching settings
Dim timeOut As Int32 = DataCache.TabCacheTimeOut * Convert.ToInt32(Common.Globals.PerformanceSetting)
'Get tabs form Database
tabs = FillTabInfoDictionary(DataProvider.Instance().GetTabs(PortalId))
'Cache tabs
If timeOut > 0 Then
DataCache.SetCache(key, tabs, TimeSpan.FromMinutes(timeOut), True)
End If
End If
Return tabs
End Function
4.授权缓存
文件:DotNetNuke_04.05.05_Source\Website\Default.aspx.vb
' set client side page caching for authenticated users
If Convert.ToString(PortalSettings.HostSettings("AuthenticatedCacheability")) <> "" Then
Select Case Convert.ToString(PortalSettings.HostSettings("AuthenticatedCacheability"))
Case "0" : Response.Cache.SetCacheability(HttpCacheability.NoCache)
Case "1" : Response.Cache.SetCacheability(HttpCacheability.Private)
Case "2" : Response.Cache.SetCacheability(HttpCacheability.Public)
Case "3" : Response.Cache.SetCacheability(HttpCacheability.Server)
Case "4" : Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
Case "5" : Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate)
End Select
Else
Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
End If
End If
上面这段源码,为什么这样设置,不明白,知道的兄弟,请指点下
附一asp.net性能优化的文章
http://book.chinaz.com/net/asp.net1/dot15.htm
5.Compression Setting: 即DNN内置的CompressionModule
<<让你的dnn飞起来,超级加速>>http://www.cnreds.com/Default.aspx?tabid=60&ArticleID=185
一文中说CompressionModule在DNN4.5中不能正常使用.实际DNN已经内置了这个功能.
6.Use Whitespace Filter: 不知道怎么用,一但勾上就出错.可能是服务文件编码设置那里不对而导致DNN不能正常运行.
上面具体都是怎么实现对系统的优化.我们在本系列以后章节,具体介绍.
ps:要冲排名2000了,大家帮忙顶下.