Thursday, February 3, 2011

MediaWiki is getting slower gradually

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.

EDIT: DB is MySQL.

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

    Stan : 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?
    From Ryan Lane
  • 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.

    Stan : Both answers are really helpful. But after I optimize database, the page loading time just like instant as before. Thanks Banis.
    Stan : 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 : I mean 'mysqlccheck -o -u xxx -p xxx databaseName'
    Banis : 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.
    From Banis

0 comments:

Post a Comment