WordPress memory usage problem
-
Recently some WP pages have been exceeding the 8MB memory limit of my PHP install (especially wp-admin/post.php after a page update). I know it is possible to increase the memory limit in the php.ini (e.g. memory_limit = 16M) but I don’t want to do this as it seems obsurd that WP should be using more than 8MB! The blog has been going successfully for nearly a year, I haven’t recently installed any extra plugins… Is it something to do with the DB size? Is it going to get gradually worse over time?
I’m running WP 1.5.2, but it’s for a client who had only just got used to 1.5.2 when v2 came out so I am yet to switch him over. I’m running various plugins such as phpexec, SpamKarma 2, TinyMCE WP, CG-Amazon, BDP-Referal tracker, wp-cache, WP-Cron and WP DB backup – but like I said none of these have been installed recently and they’ve all worked fine until now!
Any idea what could be going wrong?
-
Have you tried optimizing the tables in the database? I know you can do that i phpMyadmin, but I can’t just now remember how. I remember reducing a table size to a fourth and by that speeding up a site considerably. It wasn’t a WP-site though….
“I’m talking about the site growing, not the software”
And I’m clearly talking about both. I thought I was pretty clear in confirming what’s obvious:
1. Software growth and complexity impacts on performance.
2. Volume of traffic impacts on performance.
3. Size of the data impacts on performace.
There’s nothing unusual here, it all makes perfect sense. So why act surprised that WP should slow down as the site grows? It’s supposed to do that!
“If the majority of WP users are using hosting with memory limit set to 8MB then WP coders have to cater for this.”
Who told you that? I refuse to even entertain the thought that WP was ever designed to run in 8MB. The developers never sat around discussing things like “is making sure this thing flies in 8Mb one of our objectives?”. They built the software around functionality and usability.
Not memory.
As for “coders having to cater” for 8MB … That’s just too funny to be taken seriously. That’s a bit like saying that your current copy of your favourite word processor or spreadsheet should still be able to run on a 486 with 4MB RAM.
Good luck in convincing the development group that this is something worthwhile aspiring to! Or perhaps build your own WP “lite” version instead? After all, that’s what free software is all about.
“If the majority of WP users are using hosting with memory limit set to 8MB then WP coders have to cater for this.”
Who told you that?Note the If at the beginning of my sentence! No one has told me this, but I’m speculating that by the number of people complaining about memory usage there are probably a lot of people that do use 8MB. And don’t forget, it does work on 8MB – I’ve been using it for 2 years like that! It seems to me that by a bit of code and SQL optimisation it could continue to run successfully using a minimal amount of memory allocation. Most people want to run this on cheap hosting, most cheap hosting is set up with default options which for PHP is 8MB memory limit. If WP doesn’t run continuously and successfully on this setup then it puts it into a completely different league, with a lot less potential users.
Just read the WordPress Requirements page. This clearly states that all you need is PHP4.2 or greater and MySQL 3.23.23 or greater. If, as pizdin_dim claims it is impossible to make WP work well on the default 8MB PHP config, then that really ought to be stated as a requirement.
“Most people want to run this on cheap hosting, most cheap hosting is set up with default options which for PHP is 8MB memory limit. If WP doesn’t run continuously and successfully on this setup then it puts it into a completely different league, with a lot less potential users.”
It’s not only WP which can struggle in the default setting, it’s a lot of other web applications as I’ve already proven in one of my posts above. The problem is that a lot of the “cheapie” host providers deliberately or through ignorance leave this set to 8MB. Don’t forget that the default MySQL query cache setting is “disabled” as well and that’s how it’s often left by their database administrators. As their customer, you should be asking them why.
“If, as pizdin_dim claims it is impossible to make WP work well on the default 8MB PHP config, then that really ought to be stated as a requirement.”
It also states:
“That said, we can’t test every possible enviroment and each of the hosts on our hosting page supports the above and more with no problems.”
The fact that most “cheapie” hosts will leave PHP set to (the default) 8MB speaks for itself as that decision is based on their own commercial reasons, which can be (and often is) obviously detrimental to their customers. The fact that the PHP folks have that set to 8MB as the default is a good thing because they can’t anticipate which applications will be running within that 8MB constraint. However, it’s up to your hosts to evaluate which applications will be running on their servers and make the appropriate decision for their environment.
Tell me, when you initially approached your host and asked them if your WP installation will work on their servers, what did they say? Which questions did they ask you about your specific requirements? Or didn’t they ask any questions at all and just said “yes”, hoping that things will work today and tomorrow?
The better application host providers have more knowledgable staff who use their experience to provide a comfortable platform for their customers. The worse ones do it as cheap as possible. I think we all realise that, so really you get what you paid for. As I said, it’s time for you to put some pressure on your host providers to try and get a better deal. In terms of value, not just the money.
The system requirements page for Firefox states that it will run on a Pentium 233MHz with 64MB RAM under Windows 98. Have any of you actually tried this combination? If so, I’m willing to bet you’d be complaining about how slow it is.
Well, my host with the problems does have WordPress as one of its default applications that can be automatically installed, and they have given me 16MB, and I would not consider them a cheap host (yes, they are not expensive, but I’ve been with them for 7 years and they have good services and support).
Again, as stated on a thread I started a month ago, my site was running on php-nuke without a problem for many years and then as soon as I moved to WP, problems started happening. I have moved lots of Movabletype and flat-file sites to WordPress since January 2006, and all of them have problems.
I’d rather see us work on a solution then get defensive about the flaws in how WP operates in a mysql/php/apache/linux environment. I’m 100% willing to give the developers root access to my dedicated server that is running WP so they can see for themselves the problems. The developers have access to the private info on this forum, so they know how to contact me.
Note: my host has WP as a default app, but I installed it myself…
“I’d rather see us work on a solution then get defensive about the flaws in how WP operates in a mysql/php/apache/linux environment.”
I’m all for that too. My proposal is obviously centred around the environment and not the application. You say your host has set the PHP limit to 16MB.
1. Is that before or after you reported problems?
2. Are you saying the problem still persists at 16MB?
3. How have they configured the global MySQL cache?
4. How many other applications are being served by the same MySQL server?
5. How many sites is the Apache server serving?
6. How busy are all of those sites?16MB was after I complained. Now it is on 16MB for 6 weeks and problems persist.
However, on our dedicated server, we do have 16MB and this is the only WP site running on the server. There is a flat-file HTML site on the server, but that gets about 1000 page impressions a day and uses no mysql. Absolutely nothing else resides on that server, and in fact all the email services for the WP site still reside on the VPS on the old host. All we did was change the CNAME to point to our dedicated server, so we only have httpd and mysql running.
Also, for the global MySQL cache, which particular settings do you need info on? Pease let me know and I can get you that.
tks!
Gosh. I’m running (on a virtual server setup, and I resell “bits” of it; including the 45 domains running on my portion, there are another 153 domains on the same server), a dozen instances of wp, three instances of modx, half a dozen instances of eSyndiCat Pro, two instances of TOLRA webdir, and almost uncountable smaller php apps.
It’s all in the 8mb limit. I’ve NEVER had a problem such as you folks are describing. And the only app running anything by way of a cache is TOLRA webdir – I deactivated the wp cache on all the installs, and none of the other programs have one at all.
I should note that someone else just posted about memory issues, and made a reference to the wp cache. Not “WP-Cache” the plugin, but the internal object-caching mechanism introduced (really stupidly) in one of the 2.0.x releases.
It is possible that the cache is causing more stuff to be loaded than needed. I don’t know enough about it to say for certain.
It is also possible that with enough custom queries via plugins (or custom themes/templates) that the content passed back from MySQL, and never ‘released’, could be sizeable at times. And, certainly, if your blog has a lot of content per page (archives), then say showing 20 posts at a time is preloading a lot from SQL in one pass, then postprocessing it in PHP.
Again, if I had the time, I’d look deeply into some of the debug tools to try and get an idea what objects were taking up space in memory. Someone discussed dumping $_GLOBALS as another method. Should be pretty easy for folks having problems to try and hunt down some of the issues (and, unfortunately, those sites, with whatever plugins, and specific content, and theme, may have combinations causing ‘more problems’ than the average blogger).
-d
“It is possible that the cache is causing more stuff to be loaded than needed. I don’t know enough about it to say for certain.”
I noticed that too just a couple of hours ago. I’m not familiar with WP’s built-in caching in V2.0.x, but it may be worth disabling and doing some analysis without it.
“Also, for the global MySQL cache, which particular settings do you need info on? Pease let me know and I can get you that.”
I didn’t intend these six questions for you to answer, they are for your host providers and the Apache/PHP/MySQL administrators. Configuring the MySQL cache isn’t a “one size fits all” type of approach but
"query_cache_type"
,"query_cache_min_res_unit"
,"query_cache_limit"
and"query_cache_size"
are the main things to check. The last two are the most important. Anything under 32MB for"query_cache_size"
and under 2MB for"query_cache_limit"
is likely to be inadequate for most real-world installations in a shared enviroment. In any case, someone will need to spend a few days tweaking their particular environment.WordPressChina: did you make any progress with this?
well he asked for the support i found most of asking him to change the web host , even some people menstion there 6 year experience can’t give me right answer , you can blame your webhost if you face bad support from them or bad down time
add this below line in your .htacess file , will help you
php_value memory_limit 0M
if these don’t work show me your phpinfo file , so i can have a look and tell you wat to do , you can stay with your old host no need to change it
- The topic ‘WordPress memory usage problem’ is closed to new replies.