14 September 2023

Transient WordPress and performance optimization

Transient in WordPress: how they can improve or compromise performance and solutions to manage them effectively.

In the world of WordPress, performance optimization is a top priority for any developer or system administrator. One of the lesser-known but extremely useful features for improving the performance of a WordPress site is the use of “transients”. However, like any powerful tool, transients have their pros and cons. In this article, we will explore what transients are in WordPress, how they can be used to improve performance and how, paradoxically, they can also worsen performance if not managed correctly.

What are Transients in WordPress?

Transients in WordPress represent an advanced caching feature that allows you to store temporary data in an easily accessible and fast way. This data can range from simple strings and numbers to more complex arrays and objects. The main goal of transients is to optimize site performance by reducing the number of expensive operations, such as database queries or API calls to external services.

How Transients Work

Transients are essentially key-values ​​that are stored with an expiration period. Once the expiration period is reached, the data is automatically deleted. WordPress offers a number of API functions for working with transients, including set_transient(), get_transient() e delete_transient().

By default, transients are stored in the WordPress database in the table wp_options. However, if you use an object-level caching system like Memcached or Redis, transients can be stored there for even faster retrieval.

Features and Benefits

  1. Database Query Reduction: One of the main reasons for using transients is to reduce database queries. For example, if you have a complex query that pulls data from multiple tables and requires several joins, using a transient to store the result can significantly reduce the load on the database.
  2. API Call Optimization: If your WordPress site interacts with external services via API, transients can be used to store responses and reduce latency time in future requests.
  3. User customization: Transients can also be used to store user-specific data, such as preferences or search results, thus improving the user experience without compromising performance.
  4. Improved TTFB (Time To First Byte): With fewer database requests and less PHP processing, the time needed to serve the first chunk of data to the user's browser is reduced.
  5. Scalability: In an environment with a high volume of traffic, the use of transients can help make the system more resilient by better distributing the load.

The Transient Paradox: When Too Much Is Counterproductive

The use of transients in WordPress is often seen as a healthy practice for improving site performance. However, as often happens with powerful tools, their excessive or improper use can lead to a series of problems which, paradoxically, degrade the performance you were trying to improve. Here's a more detailed breakdown of why this may happen:

Increased CPU load

  1. Processing of Cached Data: Every time a transient is created, read, or deleted, CPU operations are required to handle these processes. In a resource-limited environment, too many of these operations can lead to CPU overload.
  2. Deadline Management: Transients have a lifespan that needs to be monitored. When a transient expires, it must be regenerated, which requires additional CPU resources.
  3. I/O operations: The CPU is also involved in the input/output operations required to read and write cached data to and from the database or object-level caching system, if any.

MySQL Performance Degradation

  1. Occupation of Space in the Database: Transients are stored in the WordPress database, often in the table wp_options. Too many transients can cause this table to grow rapidly in size, making database operations slower.
  2. Query slowdown: A table wp_options cumbersome can significantly slow down queries, especially those that require full table scans or complex joins.
  3. Database Locking: In extreme situations, an excessive number of transient-related operations can lead to database locking situations, where multiple queries are waiting to access the same resources, creating a bottleneck.

Impact on the PHP Interpreter

  1. Script Execution Time: PHP is the programming language that WordPress is built on. A large number of transients means that PHP scripts will have to spend more time handling caching logic, reducing the resources available for other operations.
  2. Complexity of the Code: Excessive use of transients can also complicate code, making it more difficult to maintain and potentially introducing errors or vulnerabilities.
  3. Memory Consumption: Each transient requires a certain amount of memory to handle. An excess of transients can therefore lead to high memory consumption, which could exceed the memory allocated for the PHP interpreter, causing errors or crashes of the site.

Profound Impact of Transients on SEO and Crawling Budget

When it comes to SEO (Search Engine Optimization), site speed and responsiveness are critical factors. Search engines like Google allocate a limited amount of resources to crawl and index websites, known as the “crawling budget”. If your site is slow or encountering performance issues, Google may decide not to spend additional resources exploring other pages on your site, thus limiting your indexing opportunities.

Impact on Loading Time and User Experience

Excessive or improper use of transients can significantly slow down page load times. This not only worsens the user experience but also sends negative signals to search engines. Google, for example, considers site speed and user experience as important factors in its ranking algorithm.

Effects on TTFB (Time To First Byte)

TTFB 200ms

TTFB is another critical indicator that search engines use to evaluate a site's performance. A high TTFB may be the result of server overload due to excessive transients, which in turn require high CPU and MySQL database resource usage. A high TTFB can reduce your crawling budget, as search engines may interpret it as a sign of low quality or technical problems with your site.

Indexing and Positioning Risks


If your crawl budget is reduced due to performance issues, this can have a direct impact on the indexing of your site's pages. Less indexed pages mean fewer opportunities to appear in search results, which could lead to a decrease in organic traffic and ultimately a reduction in conversions or sales.

How to Solve the Problem

Transient monitoring

It is critical to monitor the growth of transients over time. Tools like New Relic or WordPress-specific plugins can help with this.

Cleaning of Transients

transient cleaner WordPress plugin

If you find yourself in a situation where transients are causing performance issues, one of the most immediate solutions is to clean or delete obsolete or unused transients. While it is possible to do this manually through direct SQL queries to the database, this practice is risky if you are not database savvy. Fortunately, there are specific plugins designed to handle this task safely and efficiently. One of the most popular is “Transient Cleaner”.

What is Transient Cleaner?

transient cleaner WordPress plugin

Transient Cleaner is a WordPress plugin that offers a simple and automated solution for managing transients. The plugin is designed to clean up expired transients and orphaned transients, thus reducing database load and improving overall site performance.

Main Features

  1. Automatic Cleaning: Transient Cleaner can be configured to perform automatic cleanups at regular intervals, ensuring that obsolete transients are removed in a timely manner.
  2. Intuitive User Interface: The plugin offers a simple user interface that allows you to view all currently stored transients, with details such as the transient key, value and time remaining before expiration.
  3. Configuration Options: Transient Cleaner offers several configuration options that allow you to choose which types of transients to clean and when to do it.
  4. Compatibility: The plugin is compatible with various object-level caching systems, such as Memcached and Redis, offering a complete solution for transient management.

How to Use Transient Cleaner

After installing and activating the plugin, you can access its settings from your WordPress admin panel. From here, you can configure automatic cleanup options and, if necessary, perform a manual transient cleanup.

For more details and to download the plugin, you can visit Transient Cleaner official website.

Automation with WP-CLI and Bash Scripting

For those who want a more technical approach, you can use the WP-CLI (WordPress Command Line Interface) to manage transients. Here is an example bash script that uses a cron job to clean transients every day:

#!/bin/bash # Transient Cleanup in WordPress wp transient delete --all --allow-root

To add this script to a cron job, you can use the command crontab -e and add the following line:

0 3 * * * /path/to/script.sh

Conclusion and Advanced Solutions for Transient Management

Transients represent an effective mechanism for improving the performance of a WordPress site, but as with any powerful tool, it is essential to use them with care and awareness. Excessive or improper use can have unwanted side effects, which can range from degradation of site performance to reduction of the crawling budget allocated by search engines such as Google.

Moving to NoSQL Systems for Optimal Performance

If you are facing load and performance issues due to the use of transients, an advanced solution could be to move the data backend from MySQL to NoSQL systems such as Memcache or Redis. These systems are designed to provide extremely fast data access times and can significantly reduce latencies, thus offering a significant improvement in performance.

Specific Optimization Service for WordPress

If transient management or other performance issues are negatively impacting your WordPress site, we invite you to contact us to take advantage of our WordPress-specific optimization service. With our experience and expertise, we can address and resolve not only transient issues but also a wide range of other issues that could impact the performance and effectiveness of your site.

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.


Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.


Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds holds the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV Hetzner Online GmbH owns the rights to Hetzner®; OVHcloud is a registered trademark of OVH Groupe SAS; cPanel®, LLC owns the rights to cPanel®; Plesk® is a registered trademark of Plesk International GmbH; Facebook, Inc. owns the rights to Facebook®. This site is not affiliated, sponsored or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a trademark registered at European level by MANAGED SERVER SRL, Via Enzo Ferrari, 9, 62012 Civitanova Marche (MC), Italy.


Would you like to see how your WooCommerce runs on our systems without having to migrate anything? 

Enter the address of your WooCommerce site and you will get a navigable demonstration, without having to do absolutely anything and completely free.

No thanks, my customers prefer the slow site.
Back to top