+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / script combining a bad idea?

script combining a bad idea?

10 posts, 0 answered
  1. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    06 Jun 2011
    Link to this post
    I try to optimize a new site for speed. And here is some tests I did and the results

    Here is my claim: You better 'Turn off script combining'

    I have a support ticket open because of this but I could not make my self understood there so I wonder if someone can back me up on this.

    This is what I have done.

    ---------------------------------------------------------------------

    with script combining (admin - settings - advanced - pages) set to true
    (sf_scripts_combined_yes.png)

    I loaded my homepage -> 424'268 KB transfered
    I loaded a second page  -> 259'350 KB transfered

    Total of 683'618 kb transfered (I checked this with netlimiter2 to see if acutally the whole file gets transfered)

    ---------------------------------------

    with script combining turned off (uploaded the web.config to make sure it resarted)
    (sf_scripts_combined_no.png)

    I loaded my homepage -> 400'826 kb transfered (suprisingly 24 kb less)
    I laoded a seond page ->    25'980 kb transferd

    Total of 426'806 kb transfered
    --------------------------

    So with script combining turned of it seems I have 16 extra request to the server but 260'000 kb transrered less then with the scripts combined.

    To me it seems that if I have set scripts combinded to true if you have maybe an extra widget on the second page all scripts get sent again, where only some would be needed.

    ---------------------
    a) can anyone confirm/test this
    b) if it is confirmed is the normal behavoir or a bug

    Kind regards Markus

  2. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    07 Jun 2011
    Link to this post
    Anyone on this?

    Markus
  3. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    08 Jun 2011
    Link to this post
    I have another questions.

    I tried to set the following:

    http://www.marktold.com/screencast/combine_scripts.swf


    1) Admin - Settings - Advanced - Pages - CombineScripts = false
    2) Admin - Settings - Advanced - Pages - Script-Verwalter - EnabledCdn = checkbox checked
    3) Admin - Settings - Advacned - Pages - Script Verwalter - Script- Referenzen - TelerikSitefinity
        Path: http://aspnet-scripts.telerikstatic.com  EnableCdn = true

    a) when I do step 3) the checkbox in 2) will become unchecked
    b) when I do step 3) the CobineScripts = false from step 1) is set to true again
    c) after all these settings done i get the following transfered (see attachement)

    My ulitmate goal is to have as little requests with as little traffic (I guess its a trade off) but I am at the moment clueless what I should set in my settings.

    Thanks to some explaining of Steve it seems that using Cdn could be an good idea. I don't know if I got the right URL for the telerik Cdn (was from an older blog).

    Would it not be possible for telerik to fill in the URL by default and have us simply use a checkbox enableCdn (would be better then a true/false we have to write anyhow)

    So here are my questions

    1) does it make sense that SF sets combineScripts to true after I set enableCdn on telerikSitefinity?
    2) why do I get twice the amount of scripts (combinde from my site and once from aspnet-scripts.telerikstatic.com
    3) any help on how to optimize this is highly appreciated.

    Markus

    PS: I noticed that the EnableBrowseAndEdit it set to true automatically as well so I assume this is another bug.
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    08 Jun 2011
    Link to this post
    Hello Markus,

    Very insightful observation. The size of the requests really diminished with a lot ( 260kb) however script combining has another purpose. Note the tooltip under script combining "Defines whether to combine script resources so that less server calls are needed when rendering pages". It is used for speed optimization and as you have shown in your screenshots with script combining turned on you have made 22 HTTP requests, without it the requests are 38 which makes it easier for the server to send and the client to receive. You can review this msdn topic concerning script combining. The size differs and that matters I noticed you cleared the cache when attempting the tests. The file size with script combining is larger because you get all scripts used for your pages in one package so they can be cached and used when navigate to another page. Without the combining ON you get the scripts needed for the current page.

    Hope this information helps you. Write back if you need further assistance.

    Regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    08 Jun 2011
    Link to this post
    Dear Stanislav

    I did only clear the chache before making each test. NOT before accessing the second page.

    Since I dont know how 16 extra http request comparte to 200 KB less transfered I am not sure yet about the claim of speed optimization!

    I think maybe there is some potential for SF to be looked at!!!!!!!

    http://msdn.microsoft.com/en-us/library/cc837190%28v=vs.90%29.aspx

    Do Not Combine Too Much
    --------------------------------------------------------------------------------
      
    Combining scripts is a balance between download performance and cache performance (memory use). Download performance is the time that is required in order to download a script from the server. Cache performance is determined by how long the browser stores the script on the client, and the amount of memory that the cache requires. 
      
    Imagine a Web site that has pages named PageA.aspx and PageB.aspx. PageA.aspx references three scripts: Script1.js, Script2.js, and Script3.js. PageB.aspx references Script1.js, Script2.js, and Script4.js. The following list shows some of the possible script combinations that you can use:
      
    Create a combined script that includes Script1.js, script2.js, and Script3.js. When the user requests PageA.aspx, the first three scripts are downloaded and cached. When the user requests PageB.aspx, Script1.js and Script2.js are downloaded again, because they are combined with Script4.js, which is needed by PageB.aspx. 
      
    Create a combined script that includes Script1.js and Script2.js. If the user requests PageA.aspx, the combined script and Script3.js are downloaded and cached. If the user then requests PageB.aspx, only Script4.js is downloaded. This causes just one extra download each for PageA.aspx and PageB.aspx.
      
    Create a combined script that contains all four scripts. When a user requests PageA.aspx, all scripts are loaded. When a user requests PageB.aspx, PageB.aspx does not have to download any scripts, because they are already cached. However, if most users request PageA.aspx but never request PageB.aspx, the first request downloads more scripts than are required, which uses cache space unnecessarily.
      
    Any of these solutions might be right for a given Web site, depending on the Web-site design and on the traffic patterns for the site.



    ----------
    As per my first post. I have a panelbar on the second page which I do not have on my first page. I assume this is why I get a different combind script resource delivered.

    I just made a test and did trow an images gallery on a third page.

    Page 1 -> 232 KB
    Page 2 -> 244 KB (added Panelbar to page)
    Page 3 -> 248 KB (added Panelabar + ImageGallery to page)
    ----------------------
    Total     -> 724 KB

    With CombineScript False

    Page 1 -> 217 KB
    Page 2 ->   11 KB
    Page 3 ->    6  kb
    ------------------------
    Total     ->    234 KB

    So from a band with wise perspective at least every time one of you customers visits these 3 pages with CombineScript set to false you save about 0,5 MB

    As for speed I must test it http requests vs. extra KB -> AND only the first page is really getting a lot more http request. the other pages get the same or 3-5 more.

    EDIT; Did the test see attachment. According to fiddler2 roundtrip cost for loading the 3 pages (I did two load order 1,2,3 and 3,2,1) is faster for about 3 seconds when scripts are combinde. BUT this 3 seconds are all on the first page the next pages load about as fast as when scripts are combinde)

    Load time - After the initial load of a page when not combining scripts because off less traffic Fiddler2 would report about 6-7 seconds less because of the viewer KB)

    FAZIT: CombiningScripts makes your first page load faster. For any following page if other controls/widget are on the page the extra KB transfered will make your page (theoretically at least) load slower.

    Looking forward to feedback on from Telerik on this claim as well
    ---------

    How about looking at my latest post and answer that as well?

    Markus

    PS: If you EnableRadScriptManager on a page it seems the scripts no longer get combinde even with CombinScripts set to true -> is that supposed to happen?
  6. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    08 Jun 2011
    Link to this post
    Hello Markus,

    Sorry about not answering your previous post I was answering the first one when you posted.
    Your screenshots show no cache, but this is not the cause of difference in sizes of the scripts as explained in my previous post.

    To your second post:
    1) The problem you describe is enabling CDN for telerik Sitefinity related scripts and this negates the CDN enabling for all scripts (like jQuery and Microsoft Ajax). This is proper behaviour if you want to specify to use CDN only for some scripts. Currently CDN is experiencing problems and we don`t recommend enabling it. In Q2 it will be functioning properly.
    2) answered in my first post
    3) script combining is ASP.NET feature you can review this forum post for some tips on optimization and note it is only improving the server calls

    EnableBrowseAndEdit it set to true by default when creating a new Sitefinity project. This is by design.

    Hope this information is helpful to you.

    Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    08 Jun 2011
    Link to this post
    Dear Stanislav

    So the bottom line is

    a) CDN is not suppost to work as it is
    b) SciptCombining works but might not realy be smart
    c) When setting EnableCdn in for TelerikSitefinity EnableBrowseAndEdit will be enabled automatically

    I would have expected more!

    1) is there a PITS link for a)
    2) is having CombineScript set to true by default and if yes is this really smart
    3) is c) a bug or is this expexted behavoir - if bug PITS

    Markus
  8. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    08 Jun 2011
    Link to this post
    Hello Markus,

    Script combining will not reduce the size of the page requested for the first time, but will do it when the client returns and browse again. I hope you now can take advantage of it when needed.
    1) PITS ID is 6423 the fix is planned to be released for Q2.

    2) Script combining reduces the server calls and is basically ASP.NET feature used when necessary for the project you can best decide if it suits your needs. Having it to true by default is because Sitefinity expects a lot of widgets to be placed on a page  and lots of server calls to be needed for them.

    3) Thank you for the observation. This is a bug. I have logged it in PITS


    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Scott Rozman
    Scott Rozman avatar
    93 posts
    Registered:
    10 Oct 2012
    08 Jun 2011
    Link to this post
    To add more to this thread, I have not used the enable CDN checkbox within Sitefinity, but have included this on my MasterPage.

    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true">

    Is this not recommended at this time as well? I was thinking it may get scripts required by ASP.NET from the Microsoft CDN, but I have seen my browser loading things from the Telerik CDN as well.

  10. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    09 Jun 2011
    Link to this post

    @Stanislav

    Thanks for adding the two issues to PITS.

    I am not sure if the EnableBrowseAndEdit is the only thing that is beeing reset. CombineScript is set to true automatically as well, I don't know if this should be like this and I did not look for further things that my be reset by this bug. http://www.telerik.com/support/pits.aspx#/public/sitefinity/6425

    Steve pointed me to the RoadMap which seems to have something on this matter.
    ------------------

    Backend Script combining optimizations
    Application level script grouping will be introduced thus improving the overall performance of pages with numerous scripts.
    ------------
    Can you discuss with wour team mates if it could/would make sense to make changes for the FrontEnd Script combining as well?
    Page 1 - script1, script2, script3
    Page 2, script1, script2, script 4
    Result = when combinded script1 and script2 get loaded both times.
    ----------------
    Btw your argument 

    QUTOTE
    The file size with script combining is larger because you get all scripts used for your pages in one package so they can be cached and used when navigate to another page.
    UNQUOTE

    Is not true to me, because
    a) you don't get all scripts (only the once needed). It would be different if page1 would load script1, script2, script3, script4

    b) if not combined they get cached as well.

    ---------------

    Markus

10 posts, 0 answered