5

Over the last months, we felt that our own site – wpml.org – is slowing down. First, we took the brutal approach of upgrading the server. When this didn’t help, we put our mind to it and really analyzed the problem. The result is today’s release, which reduced our CPU load and response time by 70%.

What We’ve Learned About Performance Analysis

Performance has also been very important to us. We’ve been testing the memory, queries and CPU time of WPML for years now and improving it on every release. What we learned from this round of development is that static tests don’t always reveal the real problems.

The method that we used until now to test performance was to:

  • Create a large database with many posts, postmeta, categories and users
  • Produce a list of the «heavier» pages
  • Load them many times, measure the time it takes to load, and profile

This showed us to front-end and admin pages we need to debug and optimize. We made sure to reduce the number of queries, avoid long queries and write efficient PHP code.

So, what’s missing?

WordPress and WPML are a bit more complex than «request a page and wait for it to load». Everything happens through the database, which is a shared resource. One thing that visitor A does with the database can affect the experience that visitor B is receiving.

To understand these bottlenecks, we installed a tool called Appoptics on our production site. It allowed us to measure which functions and queries take up time, so we could analyze why.

The Actual Performance Improvement

We found that one seemingly harmless operation in String Translation had a significant resource conflict with a frequent query to the options table from another plugin. If you only run that call 1 million times, you don’t feel any problem. However, when other pages need to access the options table, they have to wait until strings are not accessing it. The list of pending requests grows, it overflows the database and all hell breaks loose.

Performance improvement for wpml.org

Looking at the graph, you can see that most of our server’s effort went into the database (that table that kept locking and unlocking). You can probably guess at what time we applied the fix.

But I Have Other Performance Issues, Can You Fix Them?

What we caught will definitely help not only wpml.org but many other busy sites that run WPML. If you have a site with very small load, you will barely feel this improvement. It only affects sites with a lot of concurrency and people doing many different things.

It’s possible that other sites can use other performance optimizations. Now we’ve learned that the best way to do this work is by installing profiling on the real production site, which suffers from poor performance. Even if we receive a copy of your database, we cannot simulate your traffic. This is why all our previous rounds didn’t catch this specific problem.

BTW, our performance improvement round didn’t reveal bottlenecks only in WPML. We fixed what we found in WPML, but we noticed dramatic issues in other places. Some, we patched ourselves and some we optimized via the database.

If you’re interested, let us know and we’ll help you install performance analysis on your production sites. Then, we’ll be very happy to help you analyze the results. If we find anything in WPML, we’ll fix it. There’s a good chance that sites with performance problems will find a number of issues coming from surprising sources.

What Else is New in WPML 4.2.6

WPML Core 4.2.6

  • Added the wpml_post_edit_meta_box_priority filter to change the WPML’s post edit meta box priority
  • Fixed issue with upgrading plugins in case sub-folder installations – using always site urls
  • Only save the notices when required to reduce extra writes to wp_options table
  • Fixed a security issue with language switcher links

WPML String Translation 2.10.4

  • Fixed an issue with ST mo file import so that wp_option table is not updated unnecessarily

WPML Translation Management 2.8.5

  • Improved styling of the pagination controls in Translation Jobs page
  • Fixed an issue with assignment of translators in the Translation Jobs page when admin language is different than English
  • Fixed improper content of «Translated by» column when admin language is different than English

WPML Media Translation 2.5.2

  • Only save the notices when required to reduce extra writes to wp_options table

WPML CMS Nav 1.5.1

  • Improved performance by clearing cache only when applicable

Download and Update

As always, you will receive this update automatically for all your registered sites. You can always log-in to your WPML account to download and install manually.

We recommend doing backups before updating anything in your site.

Feedback? Questions? Suggestions?

Our sites are running a lot faster now, but we’d love to hear about your sites. Please leave your comments and we’ll get back to you.