WordPress memory usage problem (44 posts)

  1. ianmcn
    Posted 10 years ago #

    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?

  2. davidchait
    Posted 10 years ago #

    I've always had problems running <8MB. Never sure why, what the real memory overhead of PHP itself is in a given process, etc.

    There are numerous queries that could use up memory, including the base page query, anything BDP-Referral might be doing, SpamKarma might be doing, CG-Amazon if you've got a big list that you are randomizing from, etc.

    But, I think that WP overall needs some serious performance and memory-use profiling, ASAP. I don't know if the core devs understand where bottlenecks (cpu) and usage (ram) really are -- and I can promise you that the next tier of devs (plugin coders, theme coders, etc.) likely don't. I admit I don't! ;)

    I should note that you usually are told where you are running out of memory. That's useful information -- it'll tell you the allocation that failed, for instance...


  3. WPChina
    Posted 10 years ago #

    Yes, please mister and missus developers: please find a way to have WP not eat so much server. :-)

    I have this problem too on small WP sites that don't have lots of ppl visiting...

  4. Pizdin Dim
    Posted 10 years ago #

    "I've always had problems running <8MB."

    I think most people are in that camp, whether they use WP or not. From my experience, I haven't encountered any non-trivial application which ran comfortably in only 8mb.

    Memory is cheap.

  5. lhk
    Posted 10 years ago #


    ...Memory is cheap...

    I beg to differ.

    The vast, absolute majority of users of software like WP will not run their own or co-located servers. They will have to contend with what their shared/virtual hosts allot them, and with 100 or 200 account users on a server, memory isn't cheap anymore, it's a finite commodity and your host is going to suggest a dedicated server to you, if you exceed that allotment.

    I agree that WP does have to do an overhaul of its memory and ressources management. Though I haven't had host problems with my WP installations, I noticed instead that from one major version to the next WP has become slower and clunkier.

    And no, it's not normal for a CMS to need 16 MB instead of 8. I've installed and worked with most there are, and it's the 'nukes which have that problem. Crystalclear why, there. NOT a good calling card.

  6. Pizdin Dim
    Posted 10 years ago #

    "And no, it's not normal for a CMS to need 16 MB instead of 8."

    We agree to disagree then. In my 6 years of web development, I have never seen any useful large application which actually ran without any problems in only 8mb. And you'd have to agree, WP is pretty large.

    Yes, I agree that there are "cheapie" hosts out there who stick a hundreds of accounts on their servers and then point the finger at whatever applications are using "too much" in memory. As per usual, you get what you pay for, though.

    It is not reasonable to expect something like WP to run smoothly in only 8mb. Lots of functionalty requires lots of code. Lots of code needs lots of RAM. If your host provider is only prepared to allocate 8mb then consider someone else.

  7. lhk
    Posted 10 years ago #

    Hi again,

    I still disagree. I installed and had running smoothly such CMS as Typo3, Mambo/Joomla, redaxo, Spip, Drupal or phpWebsite under 8MB, and each and every of those is a tad larger and functionwise much more sophisticated than WP. Especially Typo3 is as convoluted and empowered as you can get with OSS CMS and absolutely beyond any comparison with WP, still it behaved well in a restricted surrounding.

    The only ones I ran into trouble with were of the closer 'nukes family and such far removed but really taxing systems as XOOPS or Xaraya.

    I install also many Nucleus and Textpattern blogs and with those I never encountered any trouble either. Both are also way faster than WP by the way.

    While I agree with you that a larger memory allotment is beneficial, I also say that a blog software like WP should be able to work with less. And no, WP in my book is not a portal or wikitype CMS, even if you can get it to act like one with lots of tweaking.

    To me there is no real benefit in refusing to accept that some performance tuning is sorely needed, else WP will go the same route as quite a couple of the clunkier CMS went. And that's not really advisable.

  8. e7
    Posted 10 years ago #

    I've had a problem recently where wordpress locks up my computer when I use IE and attempt to update posts/pages. My CPU usage goes up to 100% and IE freezes.

    Oddly enough firefox seems to get around whatever is causing the issue and I can update my site. Thank god IE is not the only option... still though, it's odd because I only use IE and this only became a problem recently as I started putting more info on my site.


  9. Pizdin Dim
    Posted 10 years ago #

    "I still disagree."

    Yes, I know.

    "a blog software like WP should be able to work with less"

    Why? In practical terms, is this true at all? Where are the tangible benefits if it were to do that?

    "there is no real benefit in refusing to accept that some performance tuning is sorely needed"

    All applications need performance tuning. It just depends on how much time you have and how perfect you want to make the system. WP is a very usable, flexible and powerful system. Clearly one of the best out there. It seems to me that only a very small percentage of users are complaining about it's performance. Now that doesn't mean that the WP developers should ignore that small percentage but it does mean that the WP developers have got it right and for that they should be applauded.

    BTW: I'm not on the WP development team but I'm an experienced software developer, so I'm purely relating to the necessary practicalities with any application system.

  10. davidchait
    Posted 10 years ago #

    I'm an experienced software dev as well, but I'm not so hasty to draw conclusions... ;)

    I don't know why other systems CAN run under the 8MB bar. They're more streamlined? Less 'dynamic'? Caching to HTML? Only loading minimalist code on the front-end? Dunno.

    I don't know WHAT sits in a PHP-execution footprint. What does 'php' itself take of that 8MB? What's the BASE overhead? What's the overhead of the opcode compiler, and then the opcode data itself, as well as stack and runtime stuff? What's the overhead of opening up a MySQL connection? What's the overhead of retrieving a query? What's the overhead of output buffering? And so on...

    I'm sure an advanced web developer, who does this for a living, in PHP, for a number of years, probably has some answers... But not all. For instance, if a shared server is running an opcode cache/accelerator, that'd make a potentially huge difference in memory and speed. So different servers could easily hit different limits based on modules, settings, etc...


  11. lhk
    Posted 10 years ago #

    Hi again, pizdin_dim,

    ...Why? In practical terms, is this true at all? Where are the tangible benefits if it were to do that?...

    Quite baldly put:

    OS software is (nowadays) mainly used by people not able to fork out the dough for commercial software like Movable Type for instance. Someone who can't or won't pay 200 bucks for a commercial software also is highly unlikely to pay huge amounts for hosting.

    That's the core customer group of OSS like WordPress. Yes, I know all about the original background of Opensource. Yes, I also know quite many "because of the philosophy"-users of Opensource. Yes, I also know many coders who prefer using Opensource because of the access to the code.

    BUT: the core customer group is the one I mentioned above.

    If you have such a pronounced specific usergroup you had better heed its needs. It's truly that simple. And if you are an experienced software developer, you should have this adage written in fiery letters somewhere atop your workspace.

    We wouldn't be getting such support posts here (and more and more often lately, by the way), if this weren't the case. And no, I am not under the impression that only a few are complaining or having problems. If you read the forums closely, there are many performance and ressources related tickets here. Decidedly more e.g. than with Nucleus and TP (whose forums I also follow).

    It's also not as if that problem wasn't known among webmasters, as one such I have read many complaints over the past year (especially since WP2.0 surfaced) about these issues. They tend to stick to one's mind. WP still hasn't come back to first choice and it won't if "clunkiness" and "ressources-eating" attach themselves to its name more and more.

    I like WP and I have defended it quite a couple of times and suggested it even more often, inspite of that "Google-thang" and the constant niggling between WP and TP, both of which really caused lots of people to backpaddle. If non-usability for the core usergroup is added to that...

    And it's not necessary. A twist of mindset is all that's needed. To know one isn't as superior as one assumes, or in other words, a bit of humility in that respect, won't do any harm, que no? The moment one accepts the above facts and sets forth to deal with them, that's the moment you really better things.

  12. Pizdin Dim
    Posted 10 years ago #

    "but I'm not so hasty to draw conclusions"

    Me either.

    "I don't know why other systems CAN run under the 8MB bar. They're more streamlined? Less 'dynamic'? Caching to HTML? Only loading minimalist code on the front-end? Dunno."

    I think you've answered your own questions there, intentionally or otherwise. The answers are obviously yes, yes, yes and yes. Then again, there are a number of other applications which need 16mb or more. It just depends.

    Personally, I don't see what the concern is with having to run comfortably in only 8mb. I'm sure the WP developers have a number of more important things to do. Perhaps this is an opportunity for those folks out there who are concerned about the WP memory requirements to assist?

    Maybe V3 would be the ultimate version then?

  13. ianmcn
    Posted 10 years ago #

    Wow, didn't expect that many replies by the morning! Just to add my 2p: I think that streamlining WP should actually be one of the developers priorities as a lot of people run it on shared hosting that will have the default 8MB memory allocation and they expect it to work on that!

    As I mentioned in my initial post, I have run WP successfully for nearly a year now on the 8MB setup (and previously for some time on some £11/year shared hosting!), it is only now I'm getting problems - the main one being the wp-admin/post.php page not reloading after making a change to a page. Reading these forums I found plenty of people reporting this problem, but no answers - it was only when checking my error-logs that I realised what was happening! This is the kind of problem that would make your average user just give up on it, if WP wants to continue to succeed as an open source, but easy to manage blogging package then it is imperitive that it sorts out these memory issues.

    Finally, my main question was not "Why doesn't WP work properly on 8MB?" but "Why doesn't it work properly anymore?!" Is it something to do with DB scaling problems?

    Anyway, glad to have instigated this debate - it's time to put some pressure on!

  14. WPChina
    Posted 10 years ago #

    Well, I think my problems with memory usage and WP are well-documented on this forum.

    I was using PHP-Nuke for 4 years for a website and never had any problems. One month ago I switched the site to WP, and while staying on the identical server, VPS, etc., I immediately had problems with my host. Ever since January, when i started using WP (changed all my sites form Movabletype), EVERY site that used to run fine on Movabletype, Nuke, or mambo have now large server usage problems. None of these sites have really anymore people than before and the pages are about the same size--the only difference in the CMS.

    I really really like WP. It is like creamy butter compared to the rusty engine of Movabletype. WP just flows so smoothly and the add-ons are fantastic, the support forum is awesome, and if I could hug each one of you, I would. But something must be done asap to help WP maintain its greatness...

  15. Pizdin Dim
    Posted 10 years ago #

    Google +php +memorty_limit and you'll get over 400,000 results, so this "problem" is widespread. In fact, these applications have all had trouble running in only 8Mb or memory, at some time, for some folks. Read for yourselves:

    * TikiWiki
    * Gallery
    * Mambo
    * Drupal
    * Geeklog
    * Joomla
    * MediaWiki
    * vBulletin
    * Typo3
    * Xoops
    * PHPWebsite

    If you make the effort to read what folks are saying in the above links I posted, you'll soon realise this is not a WP issue at all. This is in fact an Apache/PHP/MySQL issue. But most of all this is a "host providers running dirt-cheap hosting plans and then whingeing that your application is using too much of their measly resources" issue.

    Your experience may be different, but mine shows that 32Mb is the norm and in fact any host provider who still insists in 2006 on 8Mb is "running on the cheap", doesn't understand modern web applications and should be avoided. Sadly, there are a number of these around but just shop around until you find someone who is better equipped.

  16. WPChina
    Posted 10 years ago #

    Bottom line: it would be nice to see developers find a way to streamline queries. Though it is a Apache/PHP/MySQL issue, streamlining by plugin developers and by the core code developers can assist in lessening strain on servers.

  17. Chris_K
    Posted 10 years ago #

    Actually... there will be a bunch of streamlining in the upcoming version. There was mention, a couple months ago, in one of the dev blogs about it.

    Darned if I can find it now... but hey, there's hope!

  18. bopuc
    Posted 10 years ago #

    All I'll say is, take an average sized WP weblog, pop in print_r($_GLOBALS), copy and paste the array it prints into a text file and weight it. Also marvel at the headscratching amount of stuff in there. If I undertsand correctly, WP shoots this missile into PHP's brain on *every page load*.

    Also ask yourself why the template tag that creates a list of authors and a count of their entries hits the database an exponentially growing number of times with every additional author. (I was up to like a bazillion SQL queries for that so I had to write my own which does the trick in one... and I run that on a CRON and include the output. Waste not want not.)


  19. WPChina
    Posted 10 years ago #

    I really hope there is streamlining on queries very very soon. I am willing to pay money to WP developers to have something done, really.

  20. Alex Mills (Viper007Bond)
    Posted 10 years ago #

    This seems like a silly conversation to me. I mean, it's like asking why Windows XP won't run on my old 486 PC.

    Get some decent hosting, people. Hosting is dirt cheap.

  21. lhk
    Posted 10 years ago #

    Hi Viper007Bond,

    sorry, but your response is pretty callous.

    Many people don't have 10+ USD per month for hosting. Even if you consider that "dirt cheap", to them it isn't.

    Blogging software, such as WP, especially OSS, often are used as a (political/societal/journalistic) expression tool for people else devoid of a means to do so. For many of these people paying 120+ bucks per year is a major expense.

    So maybe the shoe is on the other foot: a good, quality software had better get its act together regarding usability (sic!) and see to it, that it's no ressources hog.

    I am on my own dedicated server, which costs me a packet and is no meagre affair (dual 3.0 GHZ xeon, 2 giga RAM ), I host quite a few WP blogs for customers and I too see serious, very recent problems and demands made by WP since version 2.0.0. The server can deal with it, but I most certainly am NOT happy with that either. Especially when I compare these installations with those I run of Nucleus or TP. It's needless expenditure of ressources and this kind of thing is one of the points which broke a couple of other softwares' necks.

    Why be second or thirdclass if it's just a question of optimizing?

  22. Pizdin Dim
    Posted 10 years ago #

    Don't forget that streamiling database queries isn't just an application issue. There are a number of factors which contribute to the overall performance. Assuming your host uses the MySQL "query cache", ask them these questions:

    1. How is the query cache configured: is it "always on" or "on demand"?
    2. How large is the cache: both the "individual query" and the "total queries" size for all queries?
    3. How many applications (apart from yours) is the MySQL server actually serving?

    If your host isn't even using the MySQL query cache, don't even bother whinging about WP performance issues. Goto another host provider who actually understands databases and not some shonky operator doing it on the cheap.

  23. lhk
    Posted 10 years ago #

    Hi Pizdin_Dim,

    I don't "get" your approach at all.

    Many, yes, MANY people here have noticed the recent problem WP creates in this department. It's highly unlikely that they all are on the same server. Nor is it likely that all are on cheap hosts. I noticed it and I pay nearly 500 bucks for my own, and run WP for customers also, on hosts ranging from 20 bucks/year up to 50 bucks/month accounts.

    The ressources/performance problem can be noticed on ALL of them since the latest major update (2.0). Some have trouble due that change, others can (still) stomach it.

    But it's totally beside the point to blame servers, db setups, or the money available to users. It's a problem WP has/creates.

    As was said by many here, and as I can see daily in my stats, there are excellent blog softwares, competitors of WP, and even fullblown CMS which don't create such a problem. I go one step further, if such a problem were to surface in one of their usergroups and came to the awareness of the devs, people would - instead of a continueing attempt to excuse the software - snap to to remedy it.

    So what is your goal in this debate? Make WP some sort of elitist thing which can only be used by people on a hot server paying a load of money? Because that's exactly how you sound.

  24. Pizdin Dim
    Posted 10 years ago #

    "even fullblown CMS which don't create such a problem"

    Not true at all. Have a look at some specific examples I posted above.

    "totally beside the point to blame servers, db setups, or the money available to users"

    I wasn't attributing any "blame", at least that's not how I read it. I'm merely stating what should be the obvious to the more experienced members of this forum: a database application needs to have the database configured correctly for query optimisation. Most major databases have the ability to cache queries, including MySQL. Yet, my experience has been that the majority of host providers either don't enable it or don't configure it correctly. Why? Usually, 'cause they don't know how, so they just accept the defaults, which is to be expected from the "cheapie" hosts. After all, the universal law states that you almost always get what you pay for. And some say, what you therefore deserve.

    "So what is your goal in this debate? Make WP some sort of elitist thing which can only be used by people on a hot server paying a load of money? Because that's exactly how you sound."

    See my post about the really important questions about the database cache to ask your host, from above. That spells it out nicely.

    As for not "getting" my approach: I have to admit that I don't "get" yours either. You seem to be pointing the finger at only the application yet you simultaneously seem to be aware of the importance of the underlying infrastructure which supports it.

  25. WPChina
    Posted 10 years ago #

    Again, I think my posts on other threads speak for themselves. But I will, again, notify you of my problem:

    I have a WP site with about 4000-5000 pageviews a day. Quite low. The site used to sit on a VPS that cost US$15/month. Then my host complained and shut me down, so I moved the site to my own dedicated server. I am seeing big problems, still, on my own dedicated server.

    I just moved the site from movabletype to WP a few months ago. The site on MT had the same amount of daily visitors for the 2 years it ran on the VPS and on MT, but I never had a problem.

    I currently host a number of semi-popular blogs on VPSs. One blog does NOT use WP and has about 20,000 page views a day and doesn't cause any problem. However, on the exact same server at my host, I have 2 other VPS that ARE running WP and both of them, even with only 2000-3000 page views a day each, are causing major problems on the server.

    I 100% understand that the problem also lies with mysql/php/apache, however when I have a site running the perl package from Movabletype and another site with 20000 pageviews running PHP/mysql without a problem, I have to look at WP as the best thing to change in order to be better.

    Listen, Microsoft has for years placed the blame elsewhere as its public relations people pass the buck on their company's software problems, but I hope that the community here can not worry about their "face" so much and work together to pinpoint some areas where we can make WP a better product.

    Also, I am running WP-cache on all my WP sites, but I still have major problems...

  26. Pizdin Dim
    Posted 10 years ago #

    "I am seeing big problems, still, on my own dedicated server."

    Tell me, How is your cache configured?

    Without a question of a doubt, I can (from personal experience) assure you that after you have finished tweaking the database cache, you will see significant improvements. I have experienced this with Drupal, Xoops, Nucleus, TikiWiki and Mambo.

    Now that you have your dedicated server, take the time to read up on the MySQL cache and spend a few days analysing and tuning things yourself.

    BTW: Has anyone actually proven that WP2.0.x is slower than WP1.5.x? I don't have any experience with WP2.0.x, nor have I looked at the code differences, but I doubt it would be significantly more database-intensive. Does anyone know if that's true?

    Also: I thought that MT effectively works off "static" files, instead of database queries, so comparing the two on performance is irrelevant. At least until the MySQL database for WP is configured correctly.

  27. lhk
    Posted 10 years ago #

    Hi Pizdin-Dim,

    why don't you READ what WordPress China, I and others here write?

    We both run WP on own dedicated well-setup, well-configued and certainly WELL-ENDOWED servers. We both run also such software as Nucleus, TP, Joomla, SMF, etc. etc. (and yes, I absolutely, completely disagree with your statement regarding other software. I DID install the same on lesser accounts without a fraction of the trouble WP makes under these circumstances! Not once, I did so repeatedly and they run well and don't hog ressources).

    And we notice - ON THE SAME ACCOUNT/SERVER - that WP has a memory/ressources usage problem.

    I will be more precise yet: this problem started with version 2.0.0. I have a testbed 1.5 installation running (STILL ON THE SAME SERVER) and it DOES NOT cause this problem.

    All of that is pretty conclusive.

    So - stop mumbling about DB-configuration and cheap hosting, we talk (in my case) of a 500,-/month server and we talk of the same server with various reactions to WP 1.5, WP 2.0 and Nucleus/TP and others. And the "bad boy" is indeed WP.

    Thus, instead of coming up with countless excuses, maybe you can suggest HOW WORDPRESS NEEDS TO BE CHANGED to stop hogging ressources?! Because otherwise all which you have been saying is quite simply: "f..k you, if you can't put it on an expensive account."

    If users need to host a simple blogging software or CMS on an account which could stomach a chatserver, so sorry, pizdin_dim, then you've got to adjust your specs on realities a bit, because this is pretty ridiculous.

  28. Pizdin Dim
    Posted 10 years ago #

    "why don't you READ what WordPress China, I and others here write?"

    Yes, I have. Have you read what some others who oppose your point of view have written?

    "So - stop mumbling"

    Funny that you should use the term "mumbling" to describe what I had to say. Obviously you mean that I'm difficult to understand. If that's the case, it's a shame because I thought I made myself very clear. Perhaps it also tells us a little about you, no? So, let me rephrase it:


    Post the values right here, go on.

  29. ianmcn
    Posted 10 years ago #

    pizdin_dim - I think you're completely missing the point here! I have no doubt that optimising my database would make a difference, but that's not the point. When I originally chose WP what attracted me to it was the fact that it ran smoothly and quickly, even on the £11/year hosting I was on at the time! (I'm now paying significantly more for much better hosting, but that's beside the point)

    The majority of WP users do not want to be paying hundreds of pounds/dollars a year for hosting or spending days optimising their database - WP gained popularity because it was incredibly easy to install (The famous one step install!), lightweight, easy to manage and of course free! Having to buy expensive hosting or tune up databases really negates the whole point of it!

    Also, one of my original points was that WP was getting worse over time - it used to work fine but as the site grows it is noticably slowing down and consuming more memory.

  30. Pizdin Dim
    Posted 10 years ago #

    "I think you're completely missing the point here."

    That's only true if your point of view is the only valid one, which it isn't. Both arguments are valid, see below.

    "Also, one of my original points was
    that WP was getting worse over time - it used to work fine but as the site grows it is noticably slowing down and consuming more memory."

    Exactly right. And it just proves that WP is like all software. As you add features, the codebase gets bigger. As the codebase gets bigger, the application requires more resources. Take any software application in history and you'll find this to be the case. So, why should, and how could WP be any different?

    1. To expect WP to continue to work in only 8MB of memory throughout it's evolution is foolish.

    2. To expect WP to continue to work as efficiently with 10,000 requests/day as it does with 1,000 requests/day, without adjusting the database settings to accomodate the increase in workload is foolish.

    We can continue to argue about "how it once was" but the practicality of software evolution is that things change. If you want them to remain the same, don't upgrade. Nobody says you have to.

    As I've said a number of times: upping the memory limit to 32MB and spending some time on configuring a proper cached database environment will solve most of your complaints. You must realise that WP is a database-driven application, not static pages, like MT. I'd still very much like to see any one of you people who've been complaining about performance to tell me what your host has configuted the database cache. But it looks like nobody is prepared to post the numbers. Why? Is it because your cheap host can't supply them?

    The way I see it you still have a couple of choices, even if the good folks behind the WP development can't accomodate your complaints that WP2.0.x "needs fixing": if WP1.5.x was so much better, just revert back. Otherwise, put a bit of pressure on your hosts to improve their infrastructure.

Topic Closed

This topic has been closed to new replies.

About this Topic