How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

WHMCS to use caching

  • havenswift-hosting shared this idea 8 years ago
  • Core System
  • 27 Comments


111 Votes
Login to Vote
Allow the choice of using Memcached or Redis caching

32 Comments

Login to post a comment.

As any system grows in complexity and usage, performance becomes a critical concern. One of the most effective ways to enhance performance and scalability in web applications is through caching. Implementing a robust caching solution in WHMCS could greatly improve speed, efficiency, and user experience.
The https://geometrydashlitepc.io game’s difficulty increases as players progress, with each level introducing new challenges and mechanics.
We've updated this request to mark it as currently declined. This is not because we disagree with the concept of caching, but before we commit to that, we would like to understand what it is you are hoping to achieve from the introduction of it. Are there areas where you are seeing performance issues currently, and if so, what are those areas and in what ways are they presenting?
Thanks in advance!
Yes, whmcs as a whole is slowing down over time somehow and we've already emptied teh tavbles we feel we can empty (not tickets, for example!).
We're actually get complains for the users now how even just logging into the client area, paying an invoice (stripe), pacing an order is all too slow.
(and this install I'm referring to runs on a machine with only the 1 website/whmcs install on it and with plenty of Ram and HD).
> what it is you are hoping to achieve from the introduction of it

WHMCS does lots of SQL requests at least to tblconfiguration. This area of database is not changed frequently but to my testings it is queried each time WHMCS is launched.

Thus even when someone does dozens of unauthenticated requests per second to the billing website root it causes high CPU usage on server, no matter how powerful it is.

Second thing is official support of using PHP session storage at Redis/memcached - currently WHMCS only claim to support file based storage, but it has much higher overhead comparing to in-memory engines. I have configured my server to store sessions within Redis but there is alert in WHMCS admin panel stating that "System Health is breached, 1 issues Needing Attention". However it is due to that WHMCS is unaware of others than file-based session storages like Redis is.

This is the most obvious area where caching would increase performance a lot. See ticket #LIR-623178 for more details and exact benchmarks I have done.
BTW, we switched to memcached from REDIS. Unless you run a multiserver environment, Memcached is more efficient and faster on single server operations and it comes supported out of the box with WHM/cPanel.
WHM/cPanel does support LSAPI which does support Opcache. We use it.
Hi @Eric Caldwell

This is the answer I got from WHMCS support when I asked them about enabling opcache caching:

"WHMCS does not support opcache caching. The presence of this extension has been known to cause unexpected behavior with the WHMCS Software, and therefore we recommend disabling it on systems running WHMCS."
opcache does not improve WHMCS performance due to inability to correctly co-perform with ioncube - I have tried to achieve that but it required to turn of opcaches' JIT, which makes this kind of caching unusable.
Hi,
What about using opcache caching?

it is the only solution officially supported by PHP developers. The benefits are increased performance and significantly lower memory usage.

However, opcode caching extensions (including OPcache, eAccelerator and APC) aren't compatible with servers configured to use some common types of high-security PHP handlers such as suPHP (the default on WHM / cPanel Linux servers) - I hope there is a way to overcome this problem add add opcache caching support to WHMCS.
Opcache does caching of PHP compiled code, but due to ioncube loader it is impossible.
Redis
Currently, templates are cached to the disk in the templates_c directory. Using Redis would be nice.
This is a great idea
I agree with @v1ktor. Some parts of the app could be cached as they don't change as often (of course, with an expiry time). If we can control which content should be cached and which shouldn't, that could be a relief for a server for some users. Shopping cart and other data that are loaded in real time should never be cached.

It's not an important feature, but very useful one to have at hand.
Could be interesting to integrate with LiteSpeed Cache too :)
It doesn't matter how big the database is, caching helps reduce the load on the server. This may not seem necessary when you have a bunch of users logged in, and may not matter much when you have server resources to handle more users. But, when you start getting into 1000s of users concurrently using WHMCS and every single page load querying database, you'll start seeing performance issues.
WHMCS is not really dynamic, not many things in WHMCS are updated in real-time or need to be updated every page load. Plus, cache can be invalidated on user action (ex: submitting a form or clicking a button) so data is refreshed. Plus, it should be expired. For example, if your bandwidth graph/data is updated every hour or so, why would you query data from database every page load? That doesn't make sense.
Certain things can be excluded from cache, like shopping cart.
The point is, WHMCS should provide support for object caching so we can use it if needed. WHMCS has an article about high availability that's based on a talk from CEO (i think). Caching and high availability go hand in hand.
I've been all game for caching until I stepped back and remembered this as well. Like @Johann mentioned, I'm not sure how caching would make sense in WHMCS, because everything is dynamic. It sounds nice, but isn't practical. We also have a 1GB database, and on AWS, everything loads extremely fast. If anything, a focus on database query caching would be nice, but not much needed, as as long as the server/database have the resources, the load is already very fast.
Our database is 1GB (because of tickets content), and web pages loads within 0.7 sec, i don't see how caching would help in anything in such dynamic CMS
There maybe some issues with Memcached if not secured properly given volumetric attacks increased substantially.

https://www.wired.com/story/github-ddos-memcached/

But generally speaking, I do vote for the implementation of caching. I would prefer a module approach the enables external service providers such as StackPath.