DNN性能优化方案系列(1)概述

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

ExpandedBlockStart.gif ContractedBlock.gif          Public   Function GetTabModules() Function GetTabModules(ByVal TabId As IntegerAs Dictionary(Of Integer, ModuleInfo)
InBlock.gif            
Dim key As String = String.Format(DataCache.TabModuleCacheKey, TabId)
InBlock.gif
InBlock.gif            
'First Check the Tab Cache
InBlock.gif
            Dim modules As Dictionary(Of Integer, ModuleInfo) = TryCast(DataCache.GetPersistentCacheItem(key, GetType(Dictionary(Of Integer, ModuleInfo))), Dictionary(Of Integer, ModuleInfo))
InBlock.gif
InBlock.gif            
If modules Is Nothing Then
InBlock.gif                
'tabmodule caching settings
InBlock.gif
                Dim timeOut As Int32 = DataCache.TabModuleCacheTimeOut * Convert.ToInt32(Common.Globals.PerformanceSetting)
InBlock.gif
InBlock.gif                
'Get modules form Database
InBlock.gif
                modules = FillModuleInfoDictionary(DataProvider.Instance().GetTabModules(TabId))
InBlock.gif
InBlock.gif                
'Cache tabs
InBlock.gif
                If timeOut > 0 Then
InBlock.gif                    DataCache.SetCache(key, modules, TimeSpan.FromMinutes(timeOut), 
True)
InBlock.gif                
End If
InBlock.gif            
End If
InBlock.gif            
Return modules
ExpandedBlockEnd.gif        
End Function

TabController.vb

ExpandedBlockStart.gif ContractedBlock.gif          Public   Function GetTabsByPortal() Function GetTabsByPortal(ByVal PortalId As IntegerAs Dictionary(Of Integer, TabInfo)
InBlock.gif            
Dim key As String = String.Format(DataCache.TabCacheKey, PortalId)
InBlock.gif
InBlock.gif            
'First Check the Tab Cache
InBlock.gif
            Dim tabs As Dictionary(Of Integer, TabInfo) = TryCast(DataCache.GetPersistentCacheItem(key, GetType(Dictionary(Of Integer, TabInfo))), Dictionary(Of Integer, TabInfo))
InBlock.gif
InBlock.gif            
If tabs Is Nothing Then
InBlock.gif                
'tab caching settings
InBlock.gif
                Dim timeOut As Int32 = DataCache.TabCacheTimeOut * Convert.ToInt32(Common.Globals.PerformanceSetting)
InBlock.gif
InBlock.gif                
'Get tabs form Database
InBlock.gif
                tabs = FillTabInfoDictionary(DataProvider.Instance().GetTabs(PortalId))
InBlock.gif
InBlock.gif                
'Cache tabs
InBlock.gif
                If timeOut > 0 Then
InBlock.gif                    DataCache.SetCache(key, tabs, TimeSpan.FromMinutes(timeOut), 
True)
InBlock.gif                
End If
InBlock.gif            
End If
InBlock.gif
InBlock.gif            
Return tabs
ExpandedBlockEnd.gif        
End Function

None.gif


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了,大家帮忙顶下.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值