Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I just installed wordpress 3.2.1 on a pretty fresh LAMP server (specs below). On a completely fresh wordpress install, wordpress is using all available memory (512 mb) after just a few handled requests. Pages tested (which both cause the same issue) are the pre made index page and the admin page.

Right after reboot i've just above 200 mb of memory available ($> free -m) and the available memory after each request to the wordpress instance decreases drastically, ending up in memory allocation errors on server after less than 20 requests and causing 500 server error from apache.

This issue is not occurring when using other non wordpress php pages on apache. Non successful solutions have been to set memory_limit in php.ini and define('WP_MEMORY_LIMIT', ...) to various sizes.

System specs:

  • WordPress 3.2.1
  • PHP 5.3.2-1ubuntu4.9 (Zend Engine v.2.3.0)
  • Apache 2.2.14
  • Ubuntu 10.04 LTS 64-bit
share|improve this question
    
Can you tell us more about the WP? Are you using permalinks? Plugins? –  JCL1178 Aug 1 '11 at 18:48
    
Everything in the WP is out of the box. No loaded plugins and the permalinks setting is set to default "example.com/?p=123";. The preset theme is Twenty Eleven 1.2. –  fsto Aug 2 '11 at 20:29
add comment

1 Answer 1

Take a look at your apache mpm module config file. On ubuntu, it should be somewhere inside /etc/apache2/modules.available. There may be a large worker process number set for thick servers, and all the memory is used by worker processes which are not killed after request processing. Taking in account that each WP worker process uses about 40-50M of RAM, you only need 4 concurrent requests to consume 200MB, and thus all you need is to open WP dashboard because it makes a number of concurrent AJAX requests. You may want to use fastcgi configuration to be able to limit a number of PHP worker processes to save memory.

share|improve this answer
    
Thanks a lot for your answer! It sound like a probable reason. As I understand it, mpm modules has to be configured before the apache compilation. Unfortunately the default apt install of apache doesn't contain mpm worker or mpm prefork. Two questions: (1) Do you konw how to add mpm after apache has been installed. (2) Isn't the standard apache setup able to manage memory better in a case like this without explicit configuration in mpm? –  fsto Aug 3 '11 at 7:58
    
1. I can't give you a definitive instruction - download Apache source, use ./configure to configure it... A lot of work. But as far as I understand, on Debian, it works out of the box. –  karevn Aug 9 '11 at 17:20
    
2. No, it is impossible. The best Apache configuration for a low-memory system is worker mpm module + fastcgi php. For example, it worked well on my 256-m VDS and even served a decent load. –  karevn Aug 9 '11 at 17:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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