Filed under Linux
[원문] ;

We have a lot of Private labels for our application. We managed their access log and Error log in each Virtual host with Apache Http server.
If CustomLog or ErrorLog directives are placed inside a section, all requests or errors for that virtual host will be logged only to the specified file.This technique is very useful for a small number of virtual hosts, but if the number of hosts is very large, it can be complicated to manage. In addition, it can often create problems with insufficient file descriptors.
We 'luckily' got its limitation recently by adding 2 more private labels recently. So the Apache memory is keeping increasing gradually even if there is no any requests coming in.
When using a large number of Virtual Hosts, Apache may run out of available file descriptors (sometimes called file handles)if each Virtual Host specifies different log files.The limit is typically 64, and may usually be increased up to a large hard-limit.
Solution to our case:
1. We can combine all the Error logs into one Common Error log instead of creating their own within each Virtual host. So it will reduce a lot of file handles at once.
Note: If it does not work for you , then you need have to reduce your number of Virtual Hosts with single box...
2. Or you can try to adjust file handles limit before starting Apache, for example 100:
ulimit -S -n 100
exec httpd
Apache official Reference:
It is worthy to take look at the official doc carefully before using its cool features, although it is hard :)
2012/11/27 11:11 2012/11/27 11:11