Trac with mod_python slow?

I have some Trac installations running on my Ubuntu/Apache web server and I've noticed that when I monitor the CPU usage while accessing Trac pages that it is not uncommon for the CPU to spike up to a 100%. It concerns me that this happens with just one user accessing the system.

Is there a way I can make accessing Trac on my web server less CPU intensive?


Solution 1:

I have found mod wsgi to be faster than mod python.

I posted a writeup on how to setup Trac with mod_wsgi here

Solution 2:

For information: There's a discussion about that point at http://trac.edgewall.org/ticket/7490. They are referring to performance issues with KeepAlive in Apache2.x with mod_python.

Quoted from follow up 17: with keepalive on we got constant 80% CPU utilization on our server with keepalive off we got constant 15% CPU utilization on our server CPU load comes from Apache processes

Solution 3:

There was also a similar question on the Trac ML, probably it help you (in particular the last mail with a possible configuration of Apache): ML Mail (Google Groups) " Trac 0.11 so slow!!!!!"

Edit Probably, but as I didn't have such problems, this could be also from interest for you: performance and garbage collection. However, I don't think this is the case here...

Edit #2 Just remembered that with the next stable release the performance problem will be gone (if it is because of mod_defleat). See also the Dev-ML: Preparing next stable release (first point after the "However...")

Solution 4:

If you have mod_deflate enabled, try disabling it.

Solution 5:

It also depends on your database. Which database server are you using? Is it on the same host as your Trac server? Are you sure the CPU usage is coming from Apache?

Personally I've found trac runs better on mod_fastcgi, and even better on mod_wsgi. We're using a VM on a modestly spec'd VM host to host our Trac instance and it's in constant use (as in being refreshed every few seconds) by around 20 employees without any problems.