New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Reducing Memory Usage and Improving Perfomance 1 GB RAM Nginx MariaDB Php-fpm
Hi, new member here ☺️.
I have a server with specs:
- Ubuntu Linux
- Xanmod Kernel
- 1 vcpu, 1 gb of ram, 20 gb of ssd
- Dedicated
I currently run
- wordpress, mariadb, nginx, php-fpm
- docker (usememos)
- prosody (xmmp)
My question is simple, how to reducing ram usage? Is it impossible to make lower than 200?
Now my ram usage is 280M
My.cnf file:
[mysqld]
performance_schema = off
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
www.conf
pm = ondemand
Pm.max_children = 9
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
Comments
Since it is Wordpress try to use OLS and the use LiteCache (LS Cache Plug-in) this will reduce your PHP request and this will helps yo to reduce your CPU and RAM usage.
I'm not OLS fan , so i would not use that
up +1 hehe
If you want really lightweight than you can use WordOps without the dashboard panel.
without
wo stack install
, directly with commandwo site create DOMAIN.COM --othercommands
System: Debian
Use static mode for php-fpm to reduce waiting time for spamming worker processes, therefore will significantly improve performance.
Thanks for recommendation. But i dont need a panel . I'm already used to the command line interface
I dont have time to migrate. If i can, i would choose alpine as os
Any guide?
https://geekflare.com/php-fpm-optimization/
pm = ondemand
Pm.max_children = 9
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
🫡 Need suggesttion to reduce memory usage and increase perfomance. Is it
pm = static
enough?What you want achieve with 800mb space RAM?
280mb is aleardy lightweight.
pm static make more memory hungry because it initialize workers on memory, so no.
Your can probably can squeeze more ram by compiling kernel with your specific case or alpine have
-virt
kernel which remove any desktop-related module from kernel.I want to reach the point of maximum lightening. It's fun to see a bloatless server.
Is it impossible to run WordPress under 128 MB nowadays? hahahah
thank you, sir.
okay, thank you, sir
Using the 'static' mode may need some adjustments as stated by Hayden James in his article "PHP-FPM tuning: Using ‘pm static’ for max performance" available here.
The different modes are distinguished as follows:
Governor = ondemand: This mode adjusts the CPU frequency in accordance with the current load. It quickly jumps to the highest frequency before scaling down as idle time increases.
Governor = dynamic: Like 'ondemand', it adjusts the CPU frequency based on the current load, but scales the frequency more steadily.
Governor = static: This mode operates the CPU at its maximum frequency consistently.
In addition, Hayden James has provided a valuable guide on how to set up the 'static' mode.
For those interested, my archived configuration for the 'dynamic' mode can be found here. The configuration for start_servers, min_spare_servers, and max_spare_servers remains the same. However, the max children count might vary depending on the specific environment. I prefer to use this setting, which can be found here.
To set the child count, you can estimate it based on the RAM size divided by the result you get from the following command (remember to change it to match your PHP version):
ps --no-headers -o "rss,cmd" -C php-fpm8.0 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }
One more thing that you need to be pay attention if you application have some memory lacking issues or not exit after executing. Consider setting time limits and execution time or otherwise it will be more likely to be killed by oom killer.
I hope you find this information useful.
Why would you do that ? Please post output of
free -m -w
Remember, unused memory is wasted memory
memory is almost cost nothing now. just go for 2GB ram
Yes, especially in Linux.
welcome @al1r4d
thanks
Mem: 962 255 119 57 24 563 514
Swap: 0 0 0
ya i know.. i just like to optimize
halo
my.cnf tuning without mysqltuner.pl is magic from coffee beans. www.conf tuning is worthless.
okay, sir.. i dont use mysqltuner.pl btw