Background of the issue:
We are experiencing high CPU usage and significant database load on our WordPress site, which has been identified through Query Monitor as primarily originating from WPML. We have optimized our MySQL server configuration and use several caching and CDN systems, including Cloudflare, Varnish, Redis, and WP Rocket. Our site has 9 languages and about 800 products per language, using different domains per language. Our VPS server is 16 core and 32GB RAM.
Symptoms:
Very low performance on backend and frontend when pages are not cached. Frequent and slow queries involving wp_icl_translations, wp_term_taxonomy, and wp_terms tables. Excessive reads from wp_icl_mo_files_domains and large UPDATE wp_options queries with serialized data for _icl_cache.
Questions:
How can we optimize WPML to reduce high CPU usage and database load?
Are there specific configurations for large WooCommerce sites with many products and languages to improve performance?
What can be done to reduce the time it takes to save or duplicate a product in the backend?
Please try the following steps and let us know your feedback. This will help us narrow down the performance issue and troubleshoot it without affecting the live site.
a) Create a staging site
b) Switch for a moment to a WordPress default theme like 2025
c) Deactivate all the plugins that are not related to WPML, except WooCommerce & Query Monitor
d) Then check whether the issue exists or not
e) If the issue is gone, activate the plugins as a group of three or four to find which one has an interaction issue
f) Switch back to the original theme of the site
Here i am with all the steps performed and a minimal staging site with a default WordPress theme (and only the necessary plugins active: WPML, WOocommerce and ACF + query monitor obviously).
The restult is always the same slow query:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts JOIN wp_icl_translations wpml_translations
ON wp_posts.ID = wpml_translations.element_id
AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type)
WHERE 1=1
AND ( wp_posts.ID NOT IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id IN (7) ) )
AND ((wp_posts.post_type = 'product'
AND (wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'acf-disabled'
OR wp_posts.post_status = 'private')))
AND ( ( ( wpml_translations.language_code = 'en'
OR 0 )
AND wp_posts.post_type IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','product','product_variation' ) )
OR wp_posts.post_type NOT IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','product','product_variation' ) )
GROUP BY wp_posts.ID
ORDER BY wp_posts.menu_order ASC, wp_posts.post_title ASC
LIMIT 0, 16
I have set up a mariadb-slow.log file to report slow queries and i can also find this one being often slow:
SELECT tax.term_id FROM wp_icl_translations wpml_translations
JOIN wp_term_taxonomy tax
ON wpml_translations.element_id = tax.term_taxonomy_id
AND wpml_translations.element_type = CONCAT('tax_', tax.taxonomy)
JOIN wp_terms terms ON terms.term_id = tax.term_id WHERE tax.term_id != tax.term_taxonomy_id LIMIT 0, 201;
I have read that they lack "indexes" in the database, is it right?
Are there specific configurations in WPML that we could optimize to improve performance for a site like ours with 9 languages, multi-currency, multi-domain, and over 800 products per language?
It's really important for us to make it work, I can imagine there are bigger websites than ours, please advice on how they deal with WPML related performance problems.
Our difficulties are mainly in the backend (impossibile to work with products in this situation and requests often go on timeout after Save!) and also in frontend loading times when a page is not cached.
Please find a screenshot of Query monitor with the results.
I'll upload credentials for the staging area, which country are you connecting from? So I can white list it from the firewall.
Also as you can see from the screenshot there are a lot of duplicate queries, they're mainly from WPML: one from wpml-string-translation, a couple from woocommerce-multilingual but nearly all of them are from sitepress-multilingual-cms. The total is 262, quite a lot!
Thank you for the details. This needs further investigation. To clarify, in a minimal setup, are you experiencing the slow queries only on the frontend (e.g., the Shop page), or also in the backend? Please confirm.
I am enabling the private option for the next reply. Please share the credentials to access your staging (dev) site backend after taking a full site backup (mandatory).
Also, please allow us to install the Adminer plugin to access the database for deeper inspection.
Thank you for the updates and login information. I am attempting to upgrade the WPML plugin manually via FTP, as currently unable to upload or extract the ZIP file through the WordPress dashboard. Please refer to the attached images for more details.
One request: Please try the following steps after an hour. This will ensure the site connects properly with the WPML server and will also help us in debugging the issue.
- Go to Plugins>>Add New>>Commercial tab
- Click on "Unregister WPML from this site"
- Refresh the page
- Click on "Get a key for this site" (as a development site)
- Copy the newly generated code
- Visit back to Plugins>>Add New>>Commercial tab
- Register the site with the new key
In case you need it, I have a monthly subscription to Tideways, which analyzes all of the traffic and the queries in my server. If needed I will give you the credentials.
Here's a screenshot of Tideways backend.
(By the way when I try to EDIT a previous message I get nothing, just the page refreshing but cannot edit the message).
Thank you
I have done a few rounds of testing on your staging site. However, the slow queries persist after the initial checks. Now consulting with our team to get an expert opinion on this. We will get back to you as soon as possible. Please wait.
We are still working on this, and the ticket has been forwarded to our second-tier team for further investigation. We will get back to you as soon as possible with an update.
In the meantime, I have one request: if possible, please upgrade to the latest version of WooCommerce. I am currently unable to perform the upgrade from the dashboard. Refer to the attached images for more details.