I'm having issues with modx [cms system] and php performance. and I was wondering if it could have anything to do with the way php is compiled. Is there a performance benefit to compiling php with specific modules as opposed to loaded at runtime. i.e. the performance issues appear to be during database operations using pdo, the slow system has -disable-pdo, could I expect a significant performance bump if I recompiled it --with-pdo [incidentally, what does the --with-pdo=shared m
-
I personally doubt it would give much of a difference. In my previous experience, database connections not being set to persistent would lead to bottlenecks since it would have to open a new database connection for each query. – becomingwisest May 04 '12 at 02:00
-
Interesting comment that I had not considered, I have run the page in question through xdebug and can see that the getRsources & wayfinder extras can run hundreds of queries on one page request... more than my total available connections. Somehing to look at... – Sean Kimball May 04 '12 at 02:39
1 Answers
It won't really make a difference. I'm assuming you're not running PHP as CGI (FastCGI is something else). The difference in load time for statically or dynamically linked modules would only affect the initial load time, and there are performance tradeoffs for both.
It's almost impossible for the difference to add up to anything if PHP is started once and then services more than one request from your frontend server (Apache, nginx, etc). More likely, the code itself is poorly optimized, does many needless database queries, uses lookups on unindexed DB columns, does needless looping, writes and rewrites strings over and over again, and so on and so forth. The list really does just go on and on.
Profile and benchmark the code, and try and find things you can easily optimize with the least effort. Added DB indexes is a freebie and will often times make many orders of magnitude of difference in load times. Install an opcode cache (XCache is great, APC and memcache are also good). Use an object cache (memcache is best here because it shares its cache amongst all processes, but XCache or APC will work well too). Use an HTML cache. etc.

- 559
- 1
- 6
- 23