I set up my MediaWiki on a CentOS. In the first few months, it works fine and fast. But it seems gradually getting slower.

My wiki site has less than 50 pages, so it's a very small scale site. But it seems every first time when loading the page, it takes couple seconds for apache server to parse the php scripts. But the second time visit same page is instant since I configured MediaWiki's caching method as CACHE_ALL. I've also installed eAccelerator.

How to resolve this performance issue? Thanks.



This might not be correct in your case. But, typically the answer to this question for a database application is that the database needs vacuumed, optimized or some such as is appropriate for the database in question. From what I can find it looks like mysql has an OPTIMIZE TABLE command. I'd look into that.

  • Both answers are really helpful. But after I optimize database, the page loading time just like instant as before. Thanks Banis. – Stan Jul 17 '10 at 14:55
  • I use shell command 'mysqlcheck' to achieve this job. Is there any way to schedule this task every month? If I do it in crontab, I have to expose the password which is not ideal (with command like 'mysqlccheck -o -u xxx -p xxx). Thanks. – Stan Jul 17 '10 at 16:54
  • I mean 'mysqlccheck -o -u xxx -p xxx databaseName' – Stan Jul 17 '10 at 16:58
  • Mysql is not a database I know much about, but from what I can find you will need to build a cron job for this and put the password in that cron job. You can chmod the cronjob to 700 to minimize the danger. I'd run the task daily though. Do it late at night at some time when nothing else much is happening on the box. – Banis Jul 17 '10 at 20:21

Use squid/varnish. If you don't want to go through that, you could always enable the file cache in MediaWiki.

  • I enabled php cache & file cache, and did see loading speed improved. However, for the first time to load the page, still seeing a bit slow. I check the CPU usage by 'top', and can see like 20% CPU usage for httpd when loading those slow pages, while mysqld is negligible. Any idea? – Stan Jul 16 '10 at 17:43

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.