Dec 28, 2008

Why your TYPO3 web site can be slow

Today I discovered a reason why one my TYPO3 web sites were slower than it could be. The reason comes from Apache, or, more precisely from the Apache configuration.


I found that almost every second my Apache installation processed many requests from 127.0.0.1 that looks like:

GET / HTTP/1.0
User-agent: Apache (internal dummy request)


My Apache was set up so that all requests came to the first virtual host, which was a TYPO3 installation. This host uses RealURL, so RealURL was called, it tried to find the configuration for this request and... failed. There is no host name and I usually do not use default configuration for my domains. So every seconds several requests were made a TYPO3 web site with that strange user agent and they failed.

When I searched the Internet, it appeared that Apache makes such requests to its child processes when it needs to wake them up for restart or shutdown or some other purpose (pretty stupid way in my eyes). There were different suggestions how to avoid such requests. One of them was to play with “worker” module configuration to make sure that Apache always have enough worker processes and does not need to shutdown them. My configuration is optimized to handle the load to the server appropriately and avoid server overload. So I was not going to increase number of processes as some articles suggest. I did not have any notices in logs about process shutdown or overloads, so the number of processes was ok and it was not a reason for this problem. But Apache still did these requests for some reason, invoked TYPO3 and slowed down the server. Probably it caused even more such requests.

What did I do to solve the problem?

Firsts, I modified my virtual host configuration to listen only on the external IP addresses. This requires changing NameVirtualHost and all <VirtualHost> secions (they must match). Next I set a patch to the default web server and placed an empty index.html there. So now all requests go to the default server instead of TYPO3. Interestingly, number of requests per second dropped severely. Sometimes there is no even a single request.

I must say that web site in question is a very popular one. It handles hundreds requests per second. For smaller sites the problem may not be that big. But it is still good to check. It takes a very little time to optimize your web server for better TYPO3 performance even more.

No comments:

Post a Comment