Advices for settings for low ram settings

kvv213

New Member
#1
Hi All!

Could you please advice what settings shall I check in order to make work OLS with 1Gb VPS?

Wordpress (plus some static) + MariaDB + LSPHP 7.4

All the settings are almost default. I was trying to change some settings but without any success. At rush hours VPS ran out of RAM and or DBMS crashes or PHP refused to work.

Apache config works well (not as fast) but no errors. So I have to move back to Apache until I fix the memory issues.

I already got such issues:
1670346387331.png
I've increased PHP childrens a little bit. But it didn't helped in general becuase:

1670346417952.png

Also I've reduced
1670346462457.png
Soft and Hard limits didn't help in general due to PHP lockdown.
 

Cold-Egg

Administrator
#2
Is it a shopping site? If not, maybe you do not have a cache setup correctly. If the cache is working, you should not see that many php processes.

Check cache tool: https://check.lscache.io/

For a 1 GB RAM server, you can keep maxConns = 30, PHP_LSAPI_CHILDREN=30.

Let me know if you have any questions.
 

kvv213

New Member
#3
Is it a shopping site? If not, maybe you do not have a cache setup correctly. If the cache is working, you should not see that many php processes.

Check cache tool: https://check.lscache.io/

For a 1 GB RAM server, you can keep maxConns = 30, PHP_LSAPI_CHILDREN=30.

Let me know if you have any questions.
That is not trading or shop. Just a blog with WP. Which parameters except max conn and PSP children should I pay attention?
 

kvv213

New Member
#4
Is it a shopping site? If not, maybe you do not have a cache setup correctly. If the cache is working, you should not see that many php processes.

Check cache tool: https://check.lscache.io/

For a 1 GB RAM server, you can keep maxConns = 30, PHP_LSAPI_CHILDREN=30.

Let me know if you have any questions.
Didn't help in general.

The problem as it seems from my side is that there is not fast enough to process all the requests and they are stacked to each other and ate the whole RAM amount. As a result MariaDB crashes that leads to more and more delays. And I don't get 503 error.

What I'd like to get is to receive 503 error instead of crashing of DBMS. So, not speaking about caching of the pages right now.

What I have: 2 cores and 1 Gb VPS and a wordpress site on the top of it. I've moved the site to my local VPS on order to reproduce the problem and try to overcome it. Using lsphp 7.4 as the dynamic engine + MariaDB 10.10 as DBMS.

From my perspective the core settings are the following:
httpd_config.cong:
tuning {
maxConnections 150
maxSSLConnections 150
}

extprocessor lsphp {
maxConns 30
env PHP_LSAPI_CHILDREN=30
env LSAPI_AVOID_FORK=200M
persistConn 1
memSoftLimit 90M
memHardLimit 95M
procSoftLimit 400
procHardLimit 500
}

And now what I see in the logs:

stderror.log - happily empty

Server (and similar vHost log) error log:
[NOTICE] [10534] [172.23.32.1:53521] No request delivery notification has been received from LSAPI application, possible dead lock.
[NOTICE] [10533] [172.23.32.1:51019] ExtConn timed out while processing.

Code:
Dec 14 20:20:42 kvv213 kernel: [18817.160833] Tasks state (memory values in pages):
Dec 14 20:20:42 kvv213 kernel: [18817.160834] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Dec 14 20:20:42 kvv213 kernel: [18817.160837] [    355]     0   355    19218     1005   114688        0          -250 systemd-journal
Dec 14 20:20:42 kvv213 kernel: [18817.160839] [    398]     0   398     6803      961    69632        0         -1000 systemd-udevd
Dec 14 20:20:42 kvv213 kernel: [18817.160841] [    603]     0   603    70551     4493    98304        0         -1000 multipathd
Dec 14 20:20:42 kvv213 kernel: [18817.160842] [    755]   102   755     8211     1403   102400        0             0 systemd-resolve
Dec 14 20:20:42 kvv213 kernel: [18817.160844] [    837]     0   837    60652      527   102400        0             0 accounts-daemon
Dec 14 20:20:42 kvv213 kernel: [18817.160845] [    838]   107   838     2481      608    61440        0          -900 dbus-daemon
Dec 14 20:20:42 kvv213 kernel: [18817.160846] [    843]     0   843    20966      723    65536        0             0 irqbalance
Dec 14 20:20:42 kvv213 kernel: [18817.160848] [    844]     0   844    21392      507    49152        0             0 lxcfs
Dec 14 20:20:42 kvv213 kernel: [18817.160849] [    845]     0   845     9119     2805   102400        0             0 networkd-dispat
Dec 14 20:20:42 kvv213 kernel: [18817.160850] [    847]     0   847    59262      429    94208        0             0 polkitd
Dec 14 20:20:42 kvv213 kernel: [18817.160851] [    852]   104   852    56135      438    77824        0             0 rsyslogd
Dec 14 20:20:42 kvv213 kernel: [18817.160853] [    859]     0   859   218742     4065   249856        0          -900 snapd
Dec 14 20:20:42 kvv213 kernel: [18817.160854] [    861]     0   861     6528      803    86016        0             0 systemd-logind
Dec 14 20:20:42 kvv213 kernel: [18817.160857] [    863]     0   863   100458      686   143360        0             0 udisksd
Dec 14 20:20:42 kvv213 kernel: [18817.160858] [    923]     0   923    79803      981   114688        0             0 ModemManager
Dec 14 20:20:42 kvv213 kernel: [18817.160860] [   1358]     0  1358     2926      481    61440        0             0 cron
Dec 14 20:20:42 kvv213 kernel: [18817.160862] [   1363]     0  1363    77984     2334   339968        0             0 php-fpm7.2
Dec 14 20:20:42 kvv213 kernel: [18817.160863] [   1365]     0  1365    89063     2978   417792        0             0 php-fpm7.4
Dec 14 20:20:42 kvv213 kernel: [18817.160865] [   1367]     0  1367    85153     3094   417792        0             0 php-fpm8.0
Dec 14 20:20:42 kvv213 kernel: [18817.160866] [   1368]     0  1368    84978     2814   393216        0             0 php-fpm8.1
Dec 14 20:20:42 kvv213 kernel: [18817.160867] [   1369]     0  1369    86198     3128   393216        0             0 php-fpm8.2
Dec 14 20:20:42 kvv213 kernel: [18817.160868] [   1379]     0  1379    29277     2714   126976        0             0 unattended-upgr
Dec 14 20:20:42 kvv213 kernel: [18817.160869] [   1382]     0  1382     1521      561    49152        0             0 atd
Dec 14 20:20:42 kvv213 kernel: [18817.160871] [   1396]     0  1396     1702      416    53248        0             0 vsftpd
Dec 14 20:20:42 kvv213 kernel: [18817.160872] [   1405]     0  1405      622      143    49152        0             0 none
Dec 14 20:20:42 kvv213 kernel: [18817.160873] [   1416]   113  1416    18713      467    65536        0             0 ntpd
Dec 14 20:20:42 kvv213 kernel: [18817.160874] [   1428]     0  1428      652      119    40960        0             0 sshguard
Dec 14 20:20:42 kvv213 kernel: [18817.160875] [   1433]     0  1433     3587      495    69632        0         -1000 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160876] [   1435]     0  1435      652       25    40960        0             0 sshguard
Dec 14 20:20:42 kvv213 kernel: [18817.160877] [   1436]     0  1436     1034      177    49152        0             0 sshg-parser
Dec 14 20:20:42 kvv213 kernel: [18817.160878] [   1437]     0  1437     2782      317    45056        0             0 sshg-blocker
Dec 14 20:20:42 kvv213 kernel: [18817.160879] [   1438]     0  1438      652       25    40960        0             0 sshguard
Dec 14 20:20:42 kvv213 kernel: [18817.160880] [   1439]     0  1439      652      118    45056        0             0 sshg-fw-iptable
Dec 14 20:20:42 kvv213 kernel: [18817.160881] [   1440]     0  1440    38029      777   253952        0             0 journalctl
Dec 14 20:20:42 kvv213 kernel: [18817.160883] [   1461]     0  1461     2162      362    45056        0             0 agetty
Dec 14 20:20:42 kvv213 kernel: [18817.160884] [   1483]    33  1483    78081     1589   319488        0             0 php-fpm7.2
Dec 14 20:20:42 kvv213 kernel: [18817.160885] [   1484]    33  1484    78081     1590   319488        0             0 php-fpm7.2
Dec 14 20:20:42 kvv213 kernel: [18817.160886] [   1491]    33  1491    85270     1915   376832        0             0 php-fpm8.0
Dec 14 20:20:42 kvv213 kernel: [18817.160887] [   1492]    33  1492    85270     1915   376832        0             0 php-fpm8.0
Dec 14 20:20:42 kvv213 kernel: [18817.160888] [   1495]    33  1495    85083     1890   348160        0             0 php-fpm8.1
Dec 14 20:20:42 kvv213 kernel: [18817.160890] [   1496]    33  1496    85083     1890   348160        0             0 php-fpm8.1
Dec 14 20:20:42 kvv213 kernel: [18817.160891] [   1502]    33  1502   110676    15795   516096        0             0 php-fpm7.4
Dec 14 20:20:42 kvv213 kernel: [18817.160892] [   1552]    33  1552    86311     1942   372736        0             0 php-fpm8.2
Dec 14 20:20:42 kvv213 kernel: [18817.160893] [   1553]    33  1553    86311     1942   372736        0             0 php-fpm8.2
Dec 14 20:20:42 kvv213 kernel: [18817.160894] [   1576]    33  1576     1920      105    57344        0             0 htcacheclean
Dec 14 20:20:42 kvv213 kernel: [18817.160896] [   1911]     0  1911     3834      642    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160897] [   1922]     0  1922     3835      978    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160899] [   1934]  1000  1934     6870     1135    81920        0             0 systemd
Dec 14 20:20:42 kvv213 kernel: [18817.160900] [   1935]  1000  1935    28104      849   102400        0             0 (sd-pam)
Dec 14 20:20:42 kvv213 kernel: [18817.160901] [   2148]  1000  2148     3990      607    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160902] [   2149]  1000  2149     3950      628    77824        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160903] [   2150]  1000  2150     1526      561    49152        0             0 sftp-server
Dec 14 20:20:42 kvv213 kernel: [18817.160904] [   2151]  1000  2151     2795      918    57344        0             0 bash
Dec 14 20:20:42 kvv213 kernel: [18817.160905] [   2179]    33  2179    89159     1969   385024        0             0 php-fpm7.4
Dec 14 20:20:42 kvv213 kernel: [18817.160907] [   2207]     0  2207     3402      654    61440        0             0 sudo
Dec 14 20:20:42 kvv213 kernel: [18817.160908] [   2209]     0  2209     3244      650    65536        0             0 su
Dec 14 20:20:42 kvv213 kernel: [18817.160909] [   2210]     0  2210     2514      662    61440        0             0 bash
Dec 14 20:20:42 kvv213 kernel: [18817.160910] [   5005]     0  5005     3411     1467    61440        0             0 htop
Dec 14 20:20:42 kvv213 kernel: [18817.160911] [   7330]     0  7330     3834      949    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160912] [   7356]     0  7356     3835      929    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160913] [   7701]  1000  7701     3950      383    69632        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160914] [   7702]  1000  7702     3990      721    73728        0             0 sshd
Dec 14 20:20:42 kvv213 kernel: [18817.160915] [   7704]  1000  7704     1526      606    49152        0             0 sftp-server
Dec 14 20:20:42 kvv213 kernel: [18817.160916] [   7705]  1000  7705     2795      574    53248        0             0 bash
Dec 14 20:20:42 kvv213 kernel: [18817.160917] [   7761]  1000  7761     6469     1564    90112        0             0 mc
Dec 14 20:20:42 kvv213 kernel: [18817.160918] [   7768]  1000  7768     2772      898    57344        0             0 bash
Dec 14 20:20:42 kvv213 kernel: [18817.160919] [   9233]    33  9233    89159     2005   385024        0             0 php-fpm7.4
Dec 14 20:20:42 kvv213 kernel: [18817.160920] [  10189]    33 10189    77765     2674   282624        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160922] [  10531]     0 10531     5267      489    81920        0             0 litespeed
Dec 14 20:20:42 kvv213 kernel: [18817.160922] [  10532]     0 10532     3305      294    65536        0             0 litespeed
Dec 14 20:20:42 kvv213 kernel: [18817.160924] [  10533]    33 10533     6668     1390    90112        0             0 litespeed
Dec 14 20:20:42 kvv213 kernel: [18817.160924] [  10534]    33 10534     6825     1284    90112        0             0 litespeed
Dec 14 20:20:42 kvv213 kernel: [18817.160926] [  10832]    33 10832    99400    14335   385024        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160927] [  10833]    33 10833    79108    12532   364544        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160928] [  10840]    33 10840    79055    11396   364544        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160929] [  10842]    33 10842    79055    11804   364544        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160930] [  10843]    33 10843    80639    13242   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160935] [  10847]    33 10847    80127    12720   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160936] [  10848]    33 10848    82784    16229   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160937] [  10850]    33 10850    80591    13113   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160938] [  10851]    33 10851    82784    16035   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160939] [  10855]    33 10855    80079    12682   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160940] [  10856]    33 10856    82784    16002   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160941] [  10857]    33 10857    80079    12242   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160942] [  10858]    33 10858    80591    12761   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160943] [  10859]    33 10859    82784    16139   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160944] [  10860]    33 10860    80591    12768   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160945] [  10889]    33 10889    80596    12807   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160946] [  10891]    33 10891    80596    12913   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160947] [  10892]    33 10892    82756    15968   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160948] [  10893]    33 10893    80084    12571   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160949] [  10998]    33 10998    80084    12213   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160950] [  11032]    33 11032    79108    11932   364544        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160951] [  11033]    33 11033    79108    11934   364544        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160952] [  11034]    33 11034    82756    16088   393216        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160953] [  11039]    33 11039    80596    12931   376832        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160954] [  11040]    33 11040    80084    12757   372736        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160955] [  12250]    33 12250    80084    11306   368640        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160956] [  12305]   998 12305     3220      993    69632        0             0 admin_php
Dec 14 20:20:42 kvv213 kernel: [18817.160957] [  12451]   111 12451   337940    21665   413696        0             0 mariadbd
Dec 14 20:20:42 kvv213 kernel: [18817.160958] [  12456]    33 12456    80052    11440   368640        0             0 lsphp
Dec 14 20:20:42 kvv213 kernel: [18817.160959] [  12457]   998 12457     3013      573    61440        0             0 admin_php
Dec 14 20:20:42 kvv213 kernel: [18817.160960] [  12484]     0 12484     2448      289    57344        0             0 debian-start
Dec 14 20:20:42 kvv213 kernel: [18817.160961] [  12503]     0 12503     4156      931    77824        0             0 mysql
Dec 14 20:20:42 kvv213 kernel: [18817.160962] [  12504]     0 12504     2094       52    49152        0             0 xargs
Dec 14 20:20:42 kvv213 kernel: [18817.160963] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/mariadb.service,task=mariadbd,pid=12451,uid=111
Dec 14 20:20:42 kvv213 kernel: [18817.161013] Out of memory: Killed process 12451 (mariadbd) total-vm:1351760kB, anon-rss:86660kB, file-rss:0kB, shmem-rss:0kB, UID:111 pgtables:404kB oom_score_adj:0
Dec 14 20:20:42 kvv213 systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL
Dec 14 20:20:42 kvv213 debian-start[12503]: ERROR 2013 (HY000) at line 2: Lost connection to server during query
Dec 14 20:20:42 kvv213 systemd[1]: mariadb.service: Failed with result 'signal'.
Dec 14 20:20:47 kvv213 systemd[1]: mariadb.service: Scheduled restart job, restart counter is at 27.
Dec 14 20:20:47 kvv213 systemd[1]: Stopped MariaDB 10.10.2 database server.
Dec 14 20:20:47 kvv213 systemd[1]: Starting MariaDB 10.10.2 database server...
Dec 14 20:20:48 kvv213 mariadbd[12667]: 2022-12-14 20:20:48 0 [Note] /usr/sbin/mariadbd (server 10.10.2-MariaDB-1:10.10.2+maria~ubu1804-log) starting as process 12667 ...
Dec 14 20:21:54 kvv213 systemd[1]: Started MariaDB 10.10.2 database server.

So, I clearly don't understand what is the dependance between the parameters in the configs. If I limit php to 100M what will be the multiplicator? Processes or connections or children? How to be sure that the system will not be destroyed at an rush hour just because some pages are not in cache? And let people to take pages from the cache with the maximum limit.

PS. After several craches I finally get some more errors with memory and PHP (stderror.log):
[STDERR] Wed Dec 14 20:48:46 2022 (13489): Fatal Error Unable to allocate shared memory segment of 134217728 bytes: mmap: Cannot allocate memory (12)

And just increase of memSoftLimit/memHardLimit dosn't help until I increase the amount up the defaults ~2000M
 
Last edited:
Top