Varnish with mod prefork vs mpm worker with mod-fcgid

Daniel Schledermann varnish at
Wed Feb 27 08:51:16 CET 2013

Den 27-02-2013 01:52, Stephen Strickland skrev:
> When I was using mpm-preform varnish worked great with a high hit 
> rate, but the server kept getting oom errors.

Yes, mpm_prefork can be pretty memory intensive with modern CMS'es.

> *From:*nick tailor [mailto:nick.tailor at]
> *Sent:* Tuesday, February 26, 2013 7:50 PM
> *To:* Mark Strickland
> *Cc:* varnish-misc at
> *Subject:* Re: Varnish with mod prefork vs mpm worker with mod-fcgid
> I have heard of others having similar issue with same setup.
> Generally they use mpm-prefork or mod fcgi with varnish. I have heard 
> using Nginx with varnish is the way to go.
> What I would do, is disable modfcgi and see if it changes. If it does 
> you know the problems lies in the settings.

It sounds like you should sanitize the output headers from Apache. You 
might have a high number of hit_for_pass. That is the only reasonable 
way that the low level server setup should be able to influence caching 

But a better advide might be to use both Apache with mpm_prefork and 
NGINX on the site. Configure varnish to split the traffic and use NGINX 
for static files and Apache mpm_prefork for PHP requests only. That way 
you can configure the prefork with real conservative settings to only 
have a limited number of apache-processes, and maybe set 
MaxRequestsPerChild to avoid excessive ballooning of PHP memory. The 
majority of the request will go to NGINX, which do not use much memory 
in any case. That way you can keep maximum compatibility with PHP-code 
and at the same time avoid oom problems.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list