Absolute URLs and performance

Feb 12, 2013 at 11:55 AM
Hi Piedone, really nice work with this module, but I have a couple of issues with some of the fine details :)

First of all, resources which are excluded from combination seem to generate an absolute url; we noticed that when we accessed the site for the first time from the local IP in a load balanced environment; I fixed that by only passing on the PathAndQuery of the PublicUrl in the Combine method of the CombinatorService, and another couple of small changes brought on by that. Let me know if you'd like me to make a pull request, but that might take quite some time (leaving this job in a couple of days and I might not come back to Orchard for a while).

Second thing is we're noticing small delays when accessing the combined resources - i.e. chrome reports that he's waiting for the resources for hundreds of milliseconds every time (this was also true before I started hacking away at your code by the way :)). Do you have any hints on what I could check to solve this issue? With combinator disabled we're seeing blazing fast access - I'm still trying to trace the problem.

Like I said, the module is brilliant, but if I don't solve the performance problem we'll be forced to disable it... which would be a shame. I'll keep you posted if I find anything!

Feb 12, 2013 at 1:30 PM

Thanks for the great feedback and great to hear you like the module!

First of all, which version are you using? I'd advice you to try out the alpha version from the image-sprites branch. It's reasonably stable and I also have it working on some of my sites. The only issue is that it uses a css parser that's not bullet-proof yet (that's why I haven't released it yet). Also, with that version excluded resources are reference by relative url for me (this what's intended).

Combined resources are static files served from the Media folder. Combinator doesn't intercept combined resource loading in any way. So if you're seeing slow load times for combined files you may see the same for other files served fro the Media folder as well. Take a look at the Web.config in Media if there's anything that could cause this problem. Particularly the <add path="" verb="" type="System.Web.StaticFileHandler" /> line isn't needed and can cause unnecessary overhead if you're above IIS6.
Feb 12, 2013 at 1:41 PM
Thanks, I'll try out the alpha version - presumably if I don't turn on spriting it will behave much the same as the trunk version?

Anyway, I'm also using the Contrib.MediaFolder module (since I have two balanced web servers) so that might have something to do with it, but other files are served instantly. Also thanks for the hint regarding the static file handler! :)
Feb 12, 2013 at 2:49 PM
Yes, but since css parsing can have its problems review the produced stylesheet - it can choke on css properties having spaces and being enclosed in quotes.
Feb 13, 2013 at 9:28 AM
This is not really related, but in ResourceDefinitionExtensions you have this line of code:
return Path.Combine(resource.BasePath + resource.Url);

Did you perhaps mean:
return Path.Combine(resource.BasePath, resource.Url);
Feb 13, 2013 at 12:32 PM
Thanks, fixed :-).