Apache2 Virtual Hosts and FreeBSD fd limits.

Bert JW Regeer xistence at 0x58.com
Thu May 3 16:29:24 UTC 2007


On May 3, 2007, at 9:30 AM, Eduardo Meyer wrote:

>> # uname -a
>
> 5.5-STABLE FreeBSD 5.5-STABLE #6: Wed May  2 20:19:43 BRT 2007
>
>> # apachectl -v
>
> Server version: Apache/2.0.59
> Server built:   May 2 2007 18:38:18
>
>>
>> > I have raised maxfiles, but my openfiles do increase and the  
>> problem
>> > with Apache persists.
>>
>> Does it only affect Apache?
>
> Certainly not. But my concert is Apache, and this is the only
> application this server runs.
>
> I have also compiled EXTRA_FLAGS=-DFD_SETSIZE=8192 (currently, it was
> 2048) and the results were just the same.
>
>>
>> Steve
>>
>
>
> -- 
> ===========
> Eduardo Meyer
> pessoal: dudu.meyer at gmail.com
> profissional: ddm.farmaciap at saude.gov.br


Since this is my first post to the mailling list, top post or bottom  
post which one is preferred?

If you have a problems with open file descriptors beccause of  
VirtualHosts it is my guess that you are logging separately for each  
vhost (both access, and error). The way I found to solve this was to  
put it all in one file that is then split up into the separate files  
using a perl script. It is called split-logfile and can be found  
online, I believe it was in the Apache source tree. All you need to  
change is instead of having seperate log files for each of them, you  
have one log file (which outputs the information using the vhost name  
as the first item on the line so that the perl script can sort it  
through that), thus only one FD is used to log.

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User- 
Agent}i\"" cvh
CustomLog /usr/local/logs/everything.log cvh

So you can scale out to 5000 vhosts and not run into any limit  
problems. For errors the splitting up is a bit more tricky, but you  
should be able to get it done as well.

Good luck,
Bert JW Regeer


More information about the freebsd-questions mailing list