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
Public Function GetTabModules()Function GetTabModules(ByVal TabId As Integer) As Dictionary(Of Integer, ModuleInfo)
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
Public Function GetTabsByPortal()Function GetTabsByPortal(ByVal PortalId As Integer) As Dictionary(Of Integer, TabInfo)
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
If Request.IsAuthenticated = True Then
' 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了,大家幫忙頂下.