4

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:

  1. 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.

  2. 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?

3 Answers 3

7

Varnish Cache is great for this!

alt text
(source: mocsystems.com)

You may find this article interesting.

4
  • Thanks a lot for the article! It is exactly about the problem I am facing. I read a bit about varnish before but forgot to consider it in this case. So you are suggesting not using an additional file server but rather using one machine and making use of varnish cache in order to reduce the load? That would probably make things easier.
    – BMBM
    Apr 10, 2010 at 11:17
  • Yes even on the same machine a caching reverse proxy will save the day. It's not about caching alone. Handling connections with apache prefork (which is the most compatible choice for PHP) kills performance. Any reverse proxy will drastically reduce apache process count and thus memory usage.
    – korkman
    Apr 10, 2010 at 13:15
  • Hm, sounds interesting. Any good articles on how to install varnish on ubuntu?
    – BMBM
    Apr 10, 2010 at 13:52
  • apt-get install varnish :) Configuration is in /etc/varnish/default.vcl
    – rkthkr
    Apr 11, 2010 at 17:32
2

I'd say the first thing to do is to just start with mod_expires to reduce static file requests, then perhaps add mod_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.

0

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.

You must log in to answer this question.

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