Website slows down or crashes on running benchmark (ab, wrk)

#1
Hi,
I am new to OLS. Was planning to migrate from Apache as I have heard great things about OLS. So, I just setup LOMP (with PHP 8.1) with VSFTPD and phpMyAdmin on my Ubuntu 22.04 Server (Virtualbox) - 2GB RAM, 2 Cores, for testing.

My website uses PHP an has atleast 3-4 MySQL calls every page.

Haven't changed many settings. But, this is what I am noticing that wasn't there on Apache. I tried running two benchmarks (screenshots below):-
1. Ab (Apache Benchmark) - It just times out.
2. Wrk - Completes but there are timeouts in the results.

The irritating thing though is that, reloading the website after these benchmarks, it just keeps reloading and never actually reloads. I then have to go the OLS panel and graceful restart it, for the website to load.

benchmark.PNG

My first doubt was it was a server overload, but below is the htop screenshot which clearly states that almost nil resources were being used during the benchmarks. I also checked the disk usage, which was also very low.

htop.PNG

I believe that a little bit of customisation is required to get the results close to Apache or better, but, I don't know where to start. Any help is appreciated.
 
#2
Ran some more tests and found some very disappointing results.
Here is the same site with Apache (completed 10K requests in 36s)
crp-apache.png

The same website with OLS (after tweaking some things following this - forum.openlitespeed.org/threads/openlitespeed-limitation-based-on-resource.4222 Took a whopping 410s
crp-ols-without-lsmcd.png

I am still not able to make a sense of it cause in both the instances when it's run on the OLS server, the CPU usage on a single core is less than 20%, while the other core uses less than 5%. On the other hand, Apache uses 100% of both the cores while benchmarking. I am sure that the problems would be solved if there was a way to get OLS to use more resources. But, even after searching for the past few days, I can't get answer to this.
crp-ols-with-lsmcd.png
 
#3
UPDATE 2 - Tried reducing the core to 1 from 2, and yet get the same results, yet again proving that OLS refuses to use the full capacity of the machine. Would anyone please help out?
 

Cold-Egg

Administrator
#4
Is it a custom PHP site? It is weird because I did not see any PHP or OLS process running from your screenshot, have you checked if the site is loadable on your browser? Also, is it possible to apply a cache on the site?
 
#5
Is it a custom PHP site? It is weird because I did not see any PHP or OLS process running from your screenshot, have you checked if the site is loadable on your browser? Also, is it possible to apply a cache on the site?
Hey, thanks for the reply.
Yes, it's a PHP site. Pardon me for the htop screenshot. I do see mariadb, osl and lsphp on htop when the benchmark is run.
Yes, it loads and functions properly on the browser.
The final screenshot is after I installed LSMCD if that's what you mean by cache.
 
#6
I just re-installed LOMP on a fresh Ubuntu installation. Here is an htop screenshot from when the ab benchmark was running:-
htop-ols.PNG

Another interesting thing is that, OLS on aaPanel seems to be doing better than manual LOMP. Here is a screenshot of OLS ab results on aaPanel:-
ols.PNG
The only major difference I could notice when compared was that aaPanel pointed to fcgi-php (I am guessing PHP-FPM) while manual OLS uses LSAPI.

UPDATE - Checked phpinfo on aaPanel, no mention of php-fpm. Damn, back to square one. Any ideas?
 
#8
The cache I mean is LSCache, see https://docs.litespeedtech.com/lscache/noplugin/installation/#basic-rewrite-rules
Thanks, I can see the OLS and PHP process now, but the load on those process are extremely low, it might be a config issue somewhere. If the web admin is accessible via to public network, feel free to inbox me.
Figured it out. I noticed this issue didn't exists with MySQL. Turns out mariaDB has a max_connections parameter. I edited it under the file
Code:
/etc/mysql/mariadb.conf.d/50-server.cnf
and then ran the benchmark. There's still some throttling after some time, that I need to figure out. But, CPU usage did hit close to 100%.
 
Top