TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Performance and Speed Optimizations of WordPress [pdf]

29 pointsby lamostyalmost 10 years ago

4 comments

jacques_chesteralmost 10 years ago
I&#x27;ve run wordpress sites for more than a decade. I&#x27;ve never had an experience with opcode caching that wasn&#x27;t unhappy.<p>I&#x27;ve used all of them. They all crash like a demolition derby in a brewery.<p>At one point I put Wordpress into a profiler and found that a only a few percent of total time was spent compiling PHP; most of the time spent was in waiting for MySQL and concatenating strings. So I just gave up on opcode caching.<p>The biggest improvements I got were:<p>* Whole page caching. In my case, WP-supercache spitting out gzip&#x27;d pages, with Nginx configured to find and serve those gzip&#x27;d pages.<p>* MySQL query caching.<p>* Moving MySQL into another server. This was a decent win when I was on spinning rust.<p>* SSDs. MySQL is a major chokepoint for Wordpress, because until recently its idea of a query plan was &quot;let&#x27;s join half the workloads on disk in gigantic join tables&quot;.<p>* Killing bad plugins. Even the &quot;recent comments&quot; plugin that ships with mainline is horrendous.
评论 #9603208 未加载
justindocantoalmost 10 years ago
Lead Developer of TheDirty.com here. Nice work. We&#x27;re built on WordPress, running on a single machine, using Nginx + PHP-FPM, and currently serving ~20,000,000 pageviews a month.<p>Before I took over development we were running on apache w&#x2F; vanilla PHP and CPU&#x27;s would be &gt; 75% on a regular basis. The site frequently ran into the Apache 10k issue you mentioned in your paper as well. After getting the new server setup &amp; optimizing all our MySQL queries, it&#x27;s abnormal for all of our CPUs to even be doing anything. Out of all our CPUs, we might have 5 &lt; 10% currently.<p>One thing I&#x27;ve gathered from this project is technique is a huge part of optimizing WordPress. 1 resource hog at this scale is greatly amplified and can bring everything crashing down. I remember the first time I coded a simple &#x27;popular posts&#x27; widget and how hard that hit when you have 150,000 posts to run through and 300,000+ pages generating on a regular basis throughout the day. We had to scrape it the same week it went up.<p>One big example on how thinking about your queries is huge (let&#x27;s ignore page caching for a moment) is if you have a menu that queries all your categories (We have 1,000+) in the menu on every page load, and then run that query every time you generate a page, that would be ~650,000 times a day that menu query is run and the menu is generated. When you think about running one query on a table with 1,000+ rows, it sounds like nothing. But when you have to do it 650,000+ times a day... It adds up.<p>By switching our menu to be generated once every 5 minutes, having it cached in html each time, and by having that menu loaded onto every page via javascript instead; we only have to query &amp; generate the menu 288 times a day. Apply this &quot;single query&#x2F;generation + load in js technique&quot; to things like widgets within WordPress (all our related posts areas are loaded like this), it has made our resource usage less than 1% of what it used to be.<p>Although people get really excited about things like widgets &amp; cool custom plugins... It&#x27;s good to remember, if you can code, that sometimes hardcoding and&#x2F;or coming up with your own technique will save you a ton of cpu&#x2F;ram usage if you truly want to build for scale. Every single query counts. Nginx is crucial &gt; 10k connections &amp; php-fpm is a great partner for nginx as well. I&#x27;m going to print out your thesis and run through it a few times. Nice work my friend.<p>----<p>Also, idk why somebody said APC is dead. One of the most, if not the most, widely used caching plugins, W3TC, still supports APC caching and a lot of talks about WordPress optimization use APC. Personally, I find other ways to be better, but that&#x27;s another topic.
评论 #9603171 未加载
评论 #9601247 未加载
ne01almost 10 years ago
WordPress is slow by design! I have managed to create a blogging engine (in PHP) that it only takes 2ms to create the page dynamically (without caching) from the database + ~20ms for Nginx to serve it.<p>One might argue that my engine does not have as much features... and you are right.<p>Incase you are interested: SunSed.com
评论 #9600952 未加载
评论 #9601172 未加载
评论 #9602287 未加载
imaginenorealmost 10 years ago
Looks outdated. APC cache is no longer, for instance.
评论 #9600618 未加载