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?


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

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

| improve this answer | |
  • Good effort. I will give it go and see what happens. Thanks for the good write up! – Luke Jun 29 '09 at 11:52
  • I also changed from mod_python to wsgi (debian/etch -> debian/lenny) because of performing issuses. – ThorstenS Jul 26 '09 at 19:56

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

| improve this answer | |
  • I tried switching between KeepAlive On and Off but I do not see much difference. – Luke Jun 27 '09 at 4:03
  • 2
    @Luke Why did you accept this as the answer then? – Scott Dec 21 '09 at 18:04

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...")

| improve this answer | |

If you have mod_deflate enabled, try disabling it.

| improve this answer | |
  • It made some difference but not much. – Luke Jun 26 '09 at 22:24

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.

| improve this answer | |
  • I'm using the default SQLite set up. I'm using htop to monitor the CPU usage on the server and I can see the Apache thread spike up. – Luke Jun 26 '09 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.