216 reputation
48
bio website
location
age 36
visits member for 3 years, 9 months
seen Oct 22 '12 at 17:26

Mar
6
comment Refactoring Wordpress to improve memory performance
Although I did not get an answer that would satisfy my original requirements, I think you are closest to providing an answer that might, one day, lead to reduced memory usage. Enjoy the bounty!
Mar
3
comment Refactoring Wordpress to improve memory performance
I agree that WP has been fine-tuned for a long time. But I do not think it was fine-tuned to work on crappy hosting, with a particular mixture of plugins. I am curious to see how far can I push it. Even if the changes do not make it into the core, it is good to have a documented way of hacking the core if you think you must.
Feb
28
comment Refactoring Wordpress to improve memory performance
@scribu When you say "conditional loading", are you talking about autoloading, or actually loading code based on a condition? How much it hurts the speed?
Feb
28
comment Refactoring Wordpress to improve memory performance
@scribu It is on my list. Upgrade to 3.1, rerun the statistics.
Feb
28
comment Refactoring Wordpress to improve memory performance
I am going to give APC a try and see what happens. When I originally asked that question, I meant more than just opcode caching - I meant reusing the entire environment that WordPress builds - code + data. Memcached will help getting you the data faster, but you will still be cloning the data in the server memory. Now it seems that opcode caching would potentially take care of ~90% of all memory consumption.
Feb
27
comment Refactoring Wordpress to improve memory performance
@Dougal Campbell I started a bounty on this question, to see if we can hack at least this one instance of WordPress bad enough to get at least 30% memory consumption improvement now, relatively painlessly. It could inspire some of the future development.
Feb
27
comment Refactoring Wordpress to improve memory performance
@Rarst Aaand I give up for today. The biggest gain I could identify is minimizing the amount of .php code being loaded. I need to study some more to figure out how to best achieve that.
Feb
27
comment Refactoring Wordpress to improve memory performance
@scribu And I was completely wrong the whole time. My optimizations have minimal effect, as most of the memory is eaten by loaded .php code. I updated the question and added more charts.
Feb
27
comment Refactoring Wordpress to improve memory performance
@scribu I might be on to something. The WP_Object_Cache clones an object on every cache hit. Every single time you call get_post with post number as input parameter (and this is done about 15 times in my case), PHP creates yet another clone of your entire post object. This eventually leads to the post being cloned three different times in the globals, during the runtime there are many more clones. I am working on a fix.
Feb
27
comment Refactoring Wordpress to improve memory performance
I am working on it right now. I am trying to plot a map of objects in the memory, so I can see how much is used by what. Is there a tool that would take a memory dump and plot it?
Feb
27
comment Refactoring Wordpress to improve memory performance
True, it is naive. Maybe I should have said "refactor" instead of "rewrite", then it sounds much better. Post updated.
Feb
26
comment Refactoring Wordpress to improve memory performance
@Rarst Thank you very much for your help. I do think that there is stuff to fix, but it would require changing the architecture of Wordpress to some completely different philosophy, and that is too much work.
Feb
26
comment Refactoring Wordpress to improve memory performance
@Rarst It should be fine. foxloft.com/files/mbala/cachegrind.out
Feb
26
comment Refactoring Wordpress to improve memory performance
@Rarst Profiling screenshot was added.
Feb
26
comment Refactoring Wordpress to improve memory performance
@Rarst I actually did benchmark the CPU usage and I cannot point finger on any specific place that causes the trouble. Similar to memory - it seems to be spread all over the place. However, my benchmarking might not be done in an optimal way - I use the XDebug profiler and Cachegrind - it is for instance quite hard to tease apart latency due to the database calls. I'd be grateful for pointers to better profiling techniques.
Feb
26
comment Running WordPress on low-end hardware/resources?
I have similar problems, and IMHO it is not the slow CPU or storage what is killing me - it is the architecture of WordPress that creates extremely complex environment from scratch on every page load, just so the plugins can cherry-pick tiny tidbits of functionality that is actually needed.
Feb
26
comment Refactoring Wordpress to improve memory performance
I like that idea. I am not sure how much of this problem is due to I/O latencies, and how much is due to PHP slowly chewing on the data. Do you know of a way how to tell?
Feb
26
comment Refactoring Wordpress to improve memory performance
I am already using a cache, but I still have a few pages that are genuinely dynamic in nature (e.g. a shopping cart). And when the stars are not alligned correctly, the user can wait for 20 seconds - that is, granted, on GoDaddy, but even if not, I think it would be ~3 seconds at least. I simply cannot provide the kind of really snappy experience people are used to from Google.