Optimizng DNN for speed - Please contribute

Rate It (2)

Last post 02-23-2006 11:57 AM by plippard. 28 replies.

Sort Posts:

  • Optimizng DNN for speed - Please contribute

    10-02-2005, 10:41 AM
    • Contributor
      6,887 point Contributor
    • mathisjay
    • Member since 12-05-2002, 11:34 AM
    • Atlanta
    • Posts 1,376
    This is always a hot topic, so I thought it would be a good idea to start a thread with current best practices and also future wishlist/wants/enhancements that can help optimize DNN for speed.

    Lets get a good list going and we can offer it as a sticky or a optimization guide to be included in the core distribution.

    Here's a quick list of things from the top of my head in no particular order.  Please feel free to add.    I'll try to form some logical groupings once we have a list going.

    Current Best Practices
    1) Use HTTP Compression.  This is by far the single best speed optimization you can do.  IIS 6.0 compression is supposed to be the best if you have control access to the web server.  I understand the default settings are not optimal, so make sure you have it set for dynamic compression and not just static compression.  If you don't have control access to the web server, then the HTTP compression from Ben Lowery is a very close second.  This will soon be a core DNN module (maybe it already is).  You can find more information on how to integrate it into your portal from core team member Scott McCulloch (http://www.smcculloch.net/Resources/Articles/tabid/213/articleType/ArticleView/articleId/46/EnablingHTTPCompressionforDotNetNuke.aspx)

    2) Be sure the .dlls are compiled in Release mode and the web.config is set for debug="false"

    3) Use caching.  You may need to experiment to find out what works best.  DNN has a portal level setting available in Admin->Site Settings and also at the module level in the Module Settings.  I'm not exactly sure how they differ so perhaps the core team member that worked on this can offer more insight.

    4) Database optimizations ?

    5) Whitespace removal.  It is possible to remove the whitespace from the rendered html using a regex expression.  I believe there is a faurly cheap HTTP module available on snowcovered for this.  If someone has a link, please post it.  I have seen improvements of around 10-13% in the size.  However, if you are using HTTP Compression, this effect is minimal.  Some tests should be done to compare the speed reduciton from the reduced html to the slightly increased load on the processor for the regex expression.

    6) Viewstate removal.  It is possible to move the viewstate off the rendered html and store it on the server (in sesion, DB, file, etc.)  I believe there are a few commerical HTTP modules available for this on snowcovered.  Please post link if you have them. 

    7) Javascript and CSS optimization.  A lot of the .js files have a bunch of whitespace in them.  If you really want to squeeze every millisecond of performance out, you can edit these files and remove all the whitespace without affecting functionality.  Just be aware that upgrading to future DNN version will overwrite your changes, so plan accordingly.


    Future enhancements / wishlist
    1) Provide a way for the "default" css files to not be linked.   Currently, DNN automatically links a css file (~/portals/_default/default.css) at the beginning of every page.  This file provides some default css values in case your chosen skin doesn't define them.  The file itself is about 15kb.  Most decent skins will overwrite the majority of these css values so it would be nice ot have the option of not linking it in the first place.   In addition, DNN will also link another file at the end of the chain called portal.css. This file provides a way for the portal admin to override css settings without changing the skin's css.  The file itself is simply a list of all the default DNN css classes with no actual values.  It would be nice to not have to link it if its not being used.

    2) Viewstate optimization.  Much has already been done here and the issue will alleviated even more with ASP.NET v2.  However, it would be worht going over the core controls again to make sure they are not using viewstate unnecessarily.  Additionally, it would be nice if there were a core method for moving the viewstate off the rendered html and keeping it on the server similar to the commercial http modules already available.

    3) Whitespace optimizations.  It would be great if all the core .js and .css files were optimized for speed right out the box.  Additionally, providing a core method for html whitespace reduction would be nice.

    4) Database optimizations.  I remember seeing some threads a while back that someone had run some SQL Server analyzer on their DNN and found a bunch of indexes and such that could be added for increased speed.  Additionally, I have noticed some curious design choices such as the Log table using a nvarchar field as the primary key.  It would be great to have a DB guru go over the database design and make sure everything is optimal.



    Feel free to add more.
  • Re: Optimizng DNN for speed - Please contribute

    10-02-2005, 11:08 AM
    • Member
      620 point Member
    • daxdavis
    • Member since 12-19-2004, 11:05 AM
    • Dallas, TX
    • Posts 124
    I was just thinking the same thing. This is definitely a thread that needs to be done.  And I second your suggestions about optimizing the CSS and offering the ability to not load them.  Right now I am zeroing them out so that it sill load the file but it is empty.
    1. Scheduler Mode should be set to Timer Mode:
      I just recently saw a thread that mentioned changing the Scheduler Mode from Request Mode to Timer Mode.  Seems that in request mode every time a page is loaded the system looks through all of the scheduled events.  Making it Timer Mode starts up a separate thread for scheduled events and does not add the overhead to loading a page.
    2. Optimize YOUR CSS
      One thing about DNN is it has a LOT of JS and CSS.  To help make your CSS smaller check out this AWESOME and easy site:  http://www.flumpcakes.co.uk/css/optimiser/.  You cut and paste (or point the app to your css via a URL) and it will remove the white space and merge several of your CSS declarations into less lines.  When optimizing select these options, I've had execellent luck with this:  Be sure to check RGB to Hex, Combine Background, Font, Lists, *Borders. Use the Pretty Print to make the format of the CSS easier to read, but when you go live, do not check that and it will remove all of the whitespace from your CSS. Use the Pretty Print option to go back and forth between no white space and formatted CSS to make life easier for you to edit. This tends to strip 40 - 60 % of the size of my CSS files.

      EDIT> Also wanted to mention for those that are new to CSS, you can merge your css declarations into the same grouping meaning if you want e.g. A.class:Link { } and A.class:Visited { } to be the same, then you don't need to create a full definition for both of those you can instead just do A.class:Link, A.class:Visited { }.  You can do this for as many as you want to be the same.
  • Re: Optimizng DNN for speed - Please contribute

    10-02-2005, 11:49 AM
    • Contributor
      5,570 point Contributor
    • DeveloperMCDBA
    • Member since 05-08-2005, 8:08 AM
    • Deltona, FL, USA
    • Posts 1,114

    for those of you who have enabled compression on your iis6, have you noticed file downloads once downloaded by users are corrupt?

    in the metabase file, I specified ascx, aspx, etc., but not zips, but zips are now corrupt.

    any advice?

  • Re: Optimizng DNN for speed - Please contribute

    10-02-2005, 12:14 PM
    • Participant
      1,235 point Participant
    • ikamiksok
    • Member since 11-12-2003, 12:08 PM
    • Posts 247

    My "Jason" list.

    J1. Make sure the search index scheduler task is disabled if you are not using it. Many suggestions in the forums on this one.

    J2. Try changing other scheduler tasks to run less frequently or at different times. Not sure if this really does anything or is a good idea but I changed all my log purges to occur once a day at 3am.

    J3. Replace solpart menu. It has 70k js file and takes a lot of time for the first person to load for your site. You can try using one of the free menu items around here. There is a CSS one by nokiko that is free and very good. Remember if you do remove or replace it to also not have a reference to it in the skin or container. The action drop down menus also use solpart.
    http://forums.asp.net/940996/ShowPost.aspx

    J4. Remove viewstate on pages you know don't post back. My skin has a lot of links that take up a lot of viewstate. However, I have to keep the viewtate for all of them enabled because some of my pages do post backs. So, the pages you know don't post back (such as a "contact us" page, you can add a single viewtate module that disables the page viewstate and add this line of code to your page init - Page.EnableViewState = False.   Then that page will always have zero viewstate regardless of what other skins or modules have. This worked great for me!

    J5. Try caching tabs (if your site structure is now static). This is something I did personally and am wondering about how or if it could help others.
    http://forums.asp.net/1064038/ShowPost.aspx

    J6. Upgrade to 3.1.1 if you are on older version. Many performance improvements especially with tabs.

    J7. Optimize your js files. in /js. You can google & find js optimizers like the css optimzer mentioned in the post above. Also, if you stick with solpart, you can get that file down from 70k to 45k optimizing it.

    J8. Remove whitespace in default.aspx and remove html comments in DNN. This is rather tedious & perhaps a bit much, but I did go on an optimization binge and removed a lot of the whitespace in default.aspx. I also removed all the "<---" comments that DNN puts in before modules are loaded, etc......

    J9. Rename skin objects or controls to 2 or 3 letters. Another tedious one. I have a lot of controls in my skin and when dnn references them it copies the text a couple times. Especially with controls like a menu that repeats text for every menu item this may help a little. Maybe saved me 1 or 2k but it was fun to do. :)

    J10. Use Scott's www.smcculloch.net page load skin object. I haven't but it tells you how fast your page was rendered so could be useful for metrics on your optimizations.

  • Re: Optimizng DNN for speed - Please contribute

    10-02-2005, 4:53 PM
    • Member
      536 point Member
    • Sailu_tp
    • Member since 01-20-2004, 6:19 PM
    • Posts 110
    Very important thread and looks like very good suggestions. Please pin this thread if i may suggest.
    Thanks
    Sailu
  • Re: Optimizng DNN for speed - Please contribute

    10-03-2005, 12:18 PM
    • Contributor
      6,887 point Contributor
    • mathisjay
    • Member since 12-05-2002, 11:34 AM
    • Atlanta
    • Posts 1,376
    shameless bump
  • Re: Optimizng DNN for speed - Please contribute

    10-03-2005, 5:07 PM
    • Participant
      1,025 point Participant
    • mzns1
    • Member since 10-11-2004, 8:43 PM
    • Ventura, CA
    • Posts 205

    If you own the box then add RAM.  It seems that 256Mb will just barely run the OS.
    Windows Server, IIS and ASP.NET eat RAM for breakfast, lunch, dinner and a midnight snack.

    A 4Gb RAM solution works great. 

    mikez

  • Re: Optimizng DNN for speed - Please contribute

    10-03-2005, 5:59 PM
    • Contributor
      5,869 point Contributor
    • adefwebserver
    • Member since 06-07-2003, 12:50 PM
    • Los Angeles, CA
    • Posts 1,186
    I was running at 256Megs for 2 years and people said my server was fast. The only reason I upgraded my memory was that I was getting "out of memory errors" on a web services application running on that box.

    To move fast DNN needs to sit on a line with big internet feed. that is why people are so happy with the compression programs.

    In Los Angeles big intenet feed is $90-$120 a month. Not a lot if you're running a business. Remember it's tax deductable.
  • Re: Optimizng DNN for speed - Please contribute

    10-04-2005, 4:11 AM
    • Member
      515 point Member
    • RockyMoore
    • Member since 02-22-2004, 10:56 AM
    • Klamath Falls Oregon
    • Posts 105
    If you use compression Solpart it not a big problem nor CSS.  Just make sure to include the js and css files for compression.  IIRC, Solpart dropped to 16K.

    For speed, it is also best to choose skins and containers that are not so dependant on "tables" for structure.



  • Re: Optimizng DNN for speed - Please contribute

    10-04-2005, 7:45 AM
    • Member
      230 point Member
    • CShark-dnn
    • Member since 02-20-2005, 4:31 PM
    • Posts 46
    Configure you IIS:
    http://forums.asp.net/ShowPost.aspx?PageIndex=2&PostID=945866#945866

    especially if you are running DNN on a w2003 box and you have low daily hits!
    Stefan
  • Re: Optimizng DNN for speed - Please contribute

    10-07-2005, 11:42 PM
    • Contributor
      5,570 point Contributor
    • DeveloperMCDBA
    • Member since 05-08-2005, 8:08 AM
    • Deltona, FL, USA
    • Posts 1,114
    what took my server to fast to lightening fast:

    --enabling IIS6 compression properly (for files: css, js, aspx, ascx, etc ... among others)
    --keeping those darn script kiddies off my sql server ports. (one day I'll close them up completely)
  • Re: Optimizng DNN for speed - Please contribute

    10-08-2005, 12:49 AM
    • Contributor
      7,345 point Contributor
    • nbc
    • Member since 06-29-2002, 12:06 AM
    • Perth, Western Australia
    • Posts 1,469
    Besides compression you could look at what you are compressing. The average DNN site renders an awful lot of nested tables (skin/container/module) and with some work these can be reduced. Likewise images - even in these days of faster internet connections smaller images are still better than large ones.

    I can vouch for the value of experimenting with module caching, and I also think it is better to keep the home page very 'light' (especially avoid iframes, rss etc) so that it loads as quickly as possible. Once loaded your viewer will have the js and css files cached in their browser and subsequent page loads should be improved.

    Last but not least - did anyone mention keeping the app alive via any of the keepalive or site ping modules?

    Some good suggestions in this thread, very useful.
  • Re: Optimizng DNN for speed - Please contribute

    10-10-2005, 2:49 AM
    • Member
      10 point Member
    • twelvesoft
    • Member since 10-08-2005, 7:55 AM
    • Posts 2
    I've found a step by step guide to enabling IIS 6 Compression - http://www.dotnetjunkies.com/howto/16267d49-4c6e-4063-ab12-853761d31e66.dcik.  Testing it out tonight and will post if I come across any problems.
  • Re: Optimizng DNN for speed - Please contribute

    10-10-2005, 8:47 AM
    • Participant
      1,755 point Participant
    • CasperJuna
    • Member since 10-22-2004, 10:59 AM
    • The Netherlands
    • Posts 351
    I just did that exact thing like 3 days ago... average savings are around 65%! So that really saves a lot of bandwidth and gives a lot more responsiveness to your sites...
  • Re: Optimizng DNN for speed - Please contribute

    10-10-2005, 5:26 PM
    • Participant
      970 point Participant
    • bbhermann
    • Member since 09-20-2002, 11:37 AM
    • Germany
    • Posts 194
     DeveloperMCDBA wrote:

    for those of you who have enabled compression on your iis6, have you noticed file downloads once downloaded by users are corrupt?

    in the metabase file, I specified ascx, aspx, etc., but not zips, but zips are now corrupt.

    any advice?




    having the same problem; >> corrupt jpg, zip, ... ; seam to be a iis 6 bug. reason is, when dnn (also sharepoint) do the postback for a download. not yet any solution.
Page 1 of 2 (29 items) 1 2 Next >