I´m planning for a large website that includes many static assets (js, css, images and thumbnails) in the generated pages. That website will use TYPO3
as CMS (is is a customer requirement).
I guess I could seriously improve performance / page load times by using a two server setup. One server where the main application (PHP) runs and another one where the static files sit being served by a trimmed down version of apache or something like lighthttpd.
Including e. g. js or css files from the file server is of course no big deal. Just use an absolute url http://static.example.com/js/main.js
and be done with it.
But: that website will have pages with MANY thumbnails of e. g. product images on it. So I see two problems when the main application tries to create a thumbnail of some image:
the original image like
products/some.jpg
is uploaded on the static file server and therefore not on the same server as the PHP application which tries to create the thumbnail.TYPO3 writes created thumbnails to a temp directory which is expected to be on the same server. Therefore, hundreds of thumbnails will be written and served from that temp directory which is on the same server as the main application -> the static file server is in that case basically useless, all thumbnails will be requested from the server of the main application.
So, my question is: how to overcome this shortcomings?
Is it possible to "symlink" some directories to another server?
So, for example, if PHP tries to open the original products image for thumbnail creation with imagecreate("products/some.jpg")
the products folder actually "points" to the products folder on the static image server? I know something like this can be done with .htaccess
but is it possible on file system level?
Varnish Cache is great for this!
(source: mocsystems.com)
You may find this article interesting.
I'd say the first thing to do is to just start with
mod_expires
to reduce static file requests, then perhaps addmod_deflate
to lower bandwidth.Only once you actually see serious load then start partitioning on to seperate servers.
Moving static requests to a different vserver on the same apache (probably using the same document root) should be a good first step at partitioning.
Seems like noone really answered the actual question.
Having a different server handle requests for static files is significantly different from handling all requests by the same caching proxy.
Having a seperate server for static files allows clients to handle more downloads in parallel.
I am also interested in a solution to easily do this in TYPO3. I wouldn't need the static server on a seperate machine though. So file system access is not an issue for me.