cs性能优化(转)
第一阶段:
1、在Community Server的各个.config配置中,象优化WINDOWS的“服务”一样,把不必要的JOB先false掉
2、把存储到数据库的附件/图片之类的,存储到物理目录上去,主要有forums/blogs/photos/files...
把CommunityServer.config中的enableDataStoreStorage="true"替换成enableDataStoreStorage="false"
3、优化SQL Server数据库,让Community Server占用的Size减下来,这部份因为CS先天涉及到的关联太多了,所以,SQL Script比较复杂,优化还在继续,等待第一阶段的优化完成之后,我再写一个比较完整的SQL Script出来和大家分享,请大家关注一下。
第1,2、3步,大家可以先尝试优化一下,可以明显地感觉到优化后的效果。
第二阶段:
服务器上启用HTTP压缩,这样,服务器的性能就有了很大的提高,响应和访问的速度就会更快。
这是一个MS的MVP老外介绍的办法(原文附后),很管用,大家照着操作就是了。
当然,如果你是虚拟主机用户,不能操作主机,那就没办法了。
第三阶段:
更换部分Moudle。
譬如搜索,换成支持中文的,虽然网上已经有相关文章,但似乎都不太好。正在研究中~~
附:
IIS Compression in IIS6.0
Hold on to your hats folks. If you don't have compression installed on your web server, either IIS Compression or a 3rd party, and you have IIS6.0 and pay for bandwidth you're missing out on something good.
In the day of IIS5 and earlier the compression built into IIS had various issues and was really not worth implementing. To enable compression you would need to go with a 3rd party solution like www.port80software.com or www.xcompress.com. This has all changed in IIS6! At www.orcsweb.com we've been running IIS6.0 compression on some servers for a number of month with few issues, just huge performance and bandwidth benefits. Expect upwards of 4 times the compression which directly translates to bandwidth savings. This means faster loading of pages for the end user also. The only time we had to disable it was for a custom audio application for one of our clients that didn't work with compression. I'll mention at the end of this how to disable compression for an individual site.
First, for those unfamiliar with what IIS6.0 is and how to get it: IIS6.0, short for Internet Information Services 6.0, is the web software that comes with Windows Server 2003. So if you run IIS on W2K3 then you have IIS6.0. If you're wondering if you can get it apart from W2K3, sorry the answer is 'no'.
One of the issues still there today with compression in IIS is that there isn't a nice interface to manage it. It's not as straight forward as other features of IIS. No need to worry though, I'll explain the ins and outs below of how to implement this properly. I set out to implement IIS Compression a number of months ago and had a hard time finding good information about it. I did find one great post here: http://dotnetguy.techieswithcats.com/archives/003475.shtml. I've since jumped into this subject in more depth and have two things to add to Brad Wilson's article. One, an iisreset is required as I'll mention below but also there is another setting that is required for compression to be more practical for dynamic compression. The other link worth bookmarking is: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/standard/ref_prog_iaorefcompschs.asp. (I won't make any promises that this link will always work, Microsoft seems to change their links to documents all the time)
To make it easier I'll include everything needed to properly enable IIS Compression below even though I'll repeat what Brad Wilson said.
First, before anything else, backup the metabase. This is done by right-clicking on the server in the IIS snap-in and selecting All Tasks -> Backup/Restore Configuration. The rest is straight forward.
Create Compression Folder (optional)
The first thing I do is create a folder on the D drive where the static file compression will be cached. I call it ASPNetCompressTemp but you can call it anything you want or leave the default of “%windir%\IIS Temporary Compressed Files” if that works for you. The IUSR_{machinename} will need write permission to the folder. If you use custom anonymous users, make sure to assign the proper user. IIS will still work even if the permissions are wrong but the compression won't work properly. Once running, it's worth double checking Event Viewer to see if any errors are occurring that keep IIS Compression from working.
Enable Compression in IIS
- From the IIS snap-in, right-click on the Web Sites node and click on Properties
- Select the Service tab - Enable Compress application files
- Enable Compress static files
- Change Temporary Directory to the folder that you created above, or leave it at it's default
- Set the max size of the temp folder to something that the hard drive can handle. i.e. 1000.
- Save and close the Web Site Properties dialog
Note: The temporary compress directory is only used for static pages. Dynamic pages aren't saved to disk and are recreated every time so there is some CPU overhead used on every page request for dynamic content.
Create a Web Service Extension (WSE)
IIS6.0 is much more proactive than IIS5 in regards to security and introduces a new feature called Web Service Extensions. This is great but means an extra step.
- In the IIS snap-in select Web Service Extensions
- Create a new web service extension
- Call it HTTP Compression
- Point it to c:\windows\system32\inetsrv\gzip.dll
- Check the Set status checkbox so that it is enabled (Allowed) Enable Direct Metabase Edit (optional) One of many large improvement with IIS 6 is that the metabase isn't in binary format anymore and can be edited directly using Notepad or any other tools that allows editing an XML file. Personally I prefer to enable Direct Metabase Edit so that I can edit it and the change takes affect immediately. If this isn't enabled, you will need to stop and start the web services for any changes to take affect. Of course, like editing the windows registry there is always the chance of something going wrong so be careful. Unlike the windows registry though, if you make a mistake and the metabase is saved and doesn't conform to the proper XML scheme, it won't take affect, so thanks to the IIS team it's quite difficult to completely mess up the metabase. To enable this, right-click on the server (top level) in the IIS snap-in. There is a single checkbox that needs to be checked. This part couldn't get easier.
Now for the metabase changes
Now we move away from the IIS snap-in GUI and have to get our hands dirty. (well, as dirty as they can get when dealing with computer software)
Here is where the IIS team either wanted to make things a bit difficult or they didn't get the changes done in time for the final release of IIS6. Actually it's the latter as I've heard rumor that they will be improving on the GUI over time.
Note: If you want to save yourself the hassle of understanding all of this, purchase ZipEnable from Port80 Software. http://www.port80software.com/products/zipenable/. This is a tool that gives you full control down to the folder and file level and embeds itself into the IIS MMC snap-in, making things much easier. I haven't tried this out so I can't attest to it myself but Port80 Software is a company that Microsoft has recommended for years to use if you want HTTP Compression.
There are a couple ways to do this. One is to edit the metabase directly using Notepad and the other is using adsutil.vbs usually found in your C:\Inetpub\AdminScripts folder. I'll explain the direct edit method because I find it's easier to picture and understand what is happening then using a command-line tool.
- Open the metabase located at C:\Windows\system32\inetsrv\metabase.xml in Notepad
- Search for <IIsCompressionScheme
- There should be two of them, one for deflate and one for gzip. Basically they are two means of compression that IIS supports.
- First thing to do is add aspx, asmx, php and any other extension that you need to the list extensions in HcScriptFileExtensions. Make sure to follow the existing format carefully, an extra space will keep this from working correctly. Do this for both deflate and gzip.
- Now for the other thing commonly missed. HcDynamicCompressionLevel has a default value of 0. Basically this means at if you did everything else right, the compression for dynamic contact is at the lowest level. The valid range for this is from 0 to 10. I had the opportunity of receiving an internal testing summary from Chris Adams from Microsoft regarding the compression level -vs- CPU usage which showed that the CPU needed for levels 0 - 9 is fairly low but for level 10 it hits the roof. Yet the compression for level 9 is nearly as good as level 10. I write all this to say that I recommend level 9 so make sure to change HcDynamicCompressionLevel to 9. Do this for both deflate and gzip.
- Just one thing left. There are two settings that required the World Wide Web Publishing Service (WWW service) be reset. One was enabling compression and the other was HcDynamicCompressionLevel. Even with its shortcomings I simply do an iisreset from the command prompt but you can reset the service whichever way you prefer.
That's it folks. I didn't promise it would be easy but hopefully I was straight forward enough in my steps to keep this from being too difficult.
I should mention it is possible to disable or enable compression at the site or sub-folder level. This time I'll be lazy and tell you the adsutil.vbs way to do this but it can be done directly using Notepad and editing the metabase directly if you prefer. From the command prompt enter the following two commands and be sure to replace site# with the siteID that you are changing: