Previously, I raised the possibility of installing nginx or varnish as a reverse proxy, to which Joe replied that none of those options were the best, since from what I understood more than benefits, it would cause an overload, so now I ask: which memory manager Would Redis Vs Opcache be more convenient, in an environment where there is a lot of user interaction? It is not an environment of only displaying information but interacting with users.
If I may interject: Opcache will improve performance of all PHP scripts on the server while Redis is a NoSQL database server which will perform for those apps which can use it. I see Redis and Opcache as complementary to each other rather than as substitutes for each other so I am unable to understand your use of the phrase ‘Redis Vs Opcache’.
You could use both if you have enough RAM. How much RAM do you have?
Hi @calport , thanks for replying, the server is 64gb. You mention it’s nosql, does this mean it doesn’t help mysql? redis doesn’t help php, but does it help databases?
It sounds like you’re just reading about scaling and trying to throw every scaling tool at the problem without trying to understand what problem you’re trying to solve. Just adding more software to the situation does not make your websites faster (or more reliable or more whatever) automatically, and in fact, can make it slower if it introduces additional layers of latency without a good reason (as the “big pile of web servers” philosophy would do).
So, I’ll ask here the same question I had on the other thread: What problem are you trying to solve, specifically?
Hi @Joe Joe thanks for replying, the TTFB is terrible, it is currently on ubuntu 20.04 with mysql medium size since the installation does not allow huge, previously it was on ubuntu 18.04 but the TTFB situation was very slow.
What installation doesn’t allow huge? Virtualmin offers all the standard sized example configs, but they’re all just example configs. They aren’t meant to be law. Tweak the setting to suit your app and workload.
I suspect you’re running into artificial resource limits, though. Are there errors in the error log?
The absolute first thing you need to do is figure out why it is slow. You can’t act reasonably on a problem if you don’t even know what it is.
Is the database slow? Is it memory or CPU bound? Is it doing DNS lookups and those are slow? Is your application doing something pathological? Turn on slow query logging (https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html) and find out what’s taking time and why…maybe fix the pathological queries.
In your application, try turning off features or plugins that might be resource intensive. Narrow down the location of the problem.
Even without knowing anything about your deployment, I can with a high level of confidence say that it is probably not your web server. I can say with somewhat less confidence that it isn’t the database (though configuring nice big buffers to take advantage of your large amount of RAM would be a reasonable choice). I can say with a high level of confidence that it is probably a problem in your application. It almost always is.
There are easy ways to off-load the application a bit (static files served without involving the app, for example, either directly from the web server or via a CDN), but those are probably small wins. The big wins will come from finding what’s taking so long in the application and fix it. Of course, if you’re seeing thousands of requests per second, maybe it’s time to split up the load onto multiple servers, in which case a load balancing proxy server (like nginx or varnish or whatever) would become a useful addition.
In addition to the excellent ideas and suggestions that @Joe has offered, it would help if you could comparatively evaluate the TTFB of your install against an (albeit unofficial) industry standard or with other Virtualmin installs.
In 2020, a first byte rendered in less than 0.3 seconds is considered to be good and > 1 second is bad. In order to answer Joe’s question about why TTFB is slow, you should run tests on webpagetest.org or similar web performance metric testing services for all of the following:
- blank HTML page
- newly installed Wordpress website
- your web app
The difference in TTFB that you will see for the different kinds of websites which are hosted on the same Virtualmin server could give you an insight into what you need to do to address performance bottlenecks and make your particular web app work better.
I have here a link to the stats of a website on a Virtualmin server that has a modest configuration of 2 cores, 4 GB RAM and SSD storage on AWS which is consistently sending out its first byte in 0.3 to 0.4 seconds to locations in India, which is my target audience. See https://www.webpagetest.org/result/200729_CC_c66ae5c75720e2863ddbaf9dbe308d35/3/details/#waterfall_view_step1
From the US, the same server offers a TTFB of 0.7 - 0.8 sec. I prefer not to use Cloudflare etc. because my server performs better than any CDN for my target audience but putting a globally dispersed CDN in front of a server is a silver bullet that many web hosting services offer as a pseudo-solution to their clients so that they can continue to use cheap VPS hosts which offer sub-par performance - but that’s a story for another day.
I think @rechy2k is asking about Redis as an alternative to memcached. Which it does effectively with supported apps in addition to all other Swiss Army knife functions Redis is known for. But if a PHP memcache is the only reason for installing Redis, particularly for a single server with a local database server, memcached or APCu are easier and probably faster.
In defense of Redis, for distributed databases that replicate and benefit from memory-resident storage and caching without the volatility, it’s awesome. That’s my $0.02.