[mod_python] High traffic recommendations

Marc D. Murray marcdm at phronein.com
Wed Feb 15 09:06:47 EST 2006

I just 'completed' an application (website) using mod_python. 
- I'm using the mod_python.publisher handler 
- Each page is a function in a module. 
- Apache config has MultiViews enabled
- Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5
PHP/4.3.10-16 mod_ssl/2.0.54 OpenSSL/0r

However, I'm having a problem where the server (Apache) goes down every
3 - 4 hours. 

At first, I was getting a DBNoMemory error every half hour. Then I
started caching database look-ups using memcached. 

Site was still going down. Now, every hour or two, instead of 40 min.

So now, I'm caching entire pages but it still going down. Every few

This is how I'm outputting pages : 
--> request comes in 
--> mod_python.publisher decides which module.function to execute 
--> function checks session variables and loads config from cache or
*.conf file.
--> generate cache_key as sitename:req.unparsed_uri:lang  
--> If item in cache, return cached paged
--> generate page, insert into cache for 4 hrs --> return output.

But I'm still being told by Apache that it has reached MaxClients every
few hours.

in /etc/apache2/apache.conf I have the following :

	KeepAlive Off
	Timeout 10
	<IfModule prefork.c>
	StartServers         5
	MinSpareServers      5
	MaxSpareServers     10
	MaxClients          80
	MaxRequestsPerChild  500
Anyone see anything wrong with what's going on here? It's driving me
crazy with this crashing, and I can't seem to find a solution.


Marc DM.

PS. The server is the same one that used to run the same site in
mod_mono. Except with mod_mono the server would climb to 32%cpu and stay
there or climb higher. With mod_python, it never passes 4% Apache Dies.

More information about the Mod_python mailing list