0

I am using transients on my Wordpress site, and we may end up with more than 1,000,000 transients in the worst case situation. I think 500,000 is more likely, but I was wondering if having too many transients could cause some performance issues? We keep them for 1 year, because the same requests keep being made throughout the year repeatedly. I know in terms of storage it won't be much of an issue, because a single transient don't take up much space.

8
  • 2
    That's a very long time for a very large number of transients. Why do you need 1/2-1 million transients? What purpose are they serving? The context matters enormously here and makes a huge difference between a yes and a no answer. The answer depends on things you didn't mention..
    – Tom J Nowell
    Commented Sep 1, 2021 at 22:55
  • they store strings between 5 to 12 characters. They're used to limit API calls, because those API calls are expensive, not only for performance reason.
    – Sayaman
    Commented Sep 1, 2021 at 23:44
  • 1
    and do you have an object cache installed or is this falling back to the options table? If your results are stable and reliable enough to last an entire year is it worth creating a table and fetching them in advance?
    – Tom J Nowell
    Commented Sep 2, 2021 at 0:44
  • It's in the options table. Is there a way to configure transients so that they are stored through other means?
    – Sayaman
    Commented Sep 2, 2021 at 0:53
  • Yes, use an external object cache and it will automatically prefer that instead. Redis or Memcached are good options. I would strongly recommend doing so as it provides a major performance boost to all aspects of WordPress
    – Tom J Nowell
    Commented Sep 2, 2021 at 8:27

1 Answer 1

3

It depends if you add an expiration time. If you do not add an expiration time then autoload will be yes. This means the option that stores this transient will be loaded on every request even if it's not used. With large numbers of transients this poses an issue purely in terms of memory.

I would recommend installing an external object cache if you haven't, as it will make transients both more efficient, and significantly faster ( as well as most of WordPress ).

If not, then a dedicated table may be better given the length of time your transients will stick around, but a large number of transients shouldn't cause major issues if they have expiration dates.

It may actually be more efficient to implement caching on the API with the expensive endpoints rather than in the consuming WordPress install. You should contact their maintainers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.