0

In order to try & improve load time , I'm thinking of creating a specific subdomain for the files folder in a Drupal site. Further improvement could be for instance to have that specific subdomain on a cloud...

I'm not really knowledgeable about servers and I have yet a lot to learn about HTTP Requests but the basic assumption is that a page would load faster if resources are split between servers.

For example if my homepage is displaying image.jpg, the following should load faster

       http://example.com
       http://files.example.com/image.jpg 

than this

       http://example.com
       http://example.com/image.jpg 

Since I'm developing with Drupal, I know I can change my files path in the Site Configuration. I haven't yet tried to enter an absolute URL in the File System Path field but I don't find this solution flexible because it would mean having the same path on my local development site.

The only solution I can think of is to create a symlink on my server, in which case I'm wondering whether it will actually achieve the expected results, namely the example above.

I'm not sure to be clear enough so don't hesitate to leave a comment if you need further clarification.

1 Answer 1

1

The advantage you are after is having the browser increase the number of concurrent connections. To achieve this the content must be served from different (sub)domains. In other words, the URIs on your webpage pointing to the static files must be changed.

The browser doesn't care about where the files are located on your server, only about the (sub)domain they are referenced with. Typically, this would entail using a Drupal module that rewrites the links when the page is generated. (i.e. the actual links on your webpage need to change - not something behind the scenes - symlinks, redirects, and reverse-proxies will not help here.) You may want to look into the CDN module for an example of similar implementation.

Once you have the correct URLs on your webpage, then you need to serve the content from those (sub)domains. Since you have specifically mentioned using a subdomain, the typical procedure would entail adding a (CNAME) DNS entry for your domain pointing to the subdomain; setting up a VirtualHost on your web server (e.g. Apache, Nginx, Lighttpd, etc) with the Server Name matching your subdomain; and pointing the Document Root at your static files. This is where changing your file path may be relevant - have Drupal upload the files to the Document Root of your subdomain (providing that the file ownership and permissions are the same as your main site) - or you could use your symlink idea - but your web server needs to be setup to Follow Symlinks.

It is worth mentioning that there is a 'cost' to serving content from a subdomain. It requires an additional DNS lookup. Sometimes this cost outweighs the gains of concurrency, especially if you are only serving a few static files. The best 'perceived' performance may be attained by minimizing the number of requests needed to render everything in its place - and limiting the blocking scripts. Other factors aside, serve these initial resources from the same (sub)domain as your main site - and serve other content (e.g. images) from your 'static' subdomain.

2
  • Thanks for pointing out the CDN Module, which led me to a great article by Wim Leers, the module's author. Here's the link wimleers.com/article/improving-drupals-page-loading-performance
    – PatrickS
    Dec 29, 2011 at 3:11
  • You're welcome - thanks for the link (and for accepting the answer). A quick glance over that article (which is very good) suggests two more possible ideas: In addition to YSlow, check out Google's PageSpeed plugin (and read the rationale) and serve JS libraries from Google to improve caching.
    – cyberx86
    Dec 29, 2011 at 3:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .