Skip to content

Commit b4b93fc

Browse files
committed
Adjusted memory totals
Added some safeguards to ensure low-mem servers have less of a chance to run out of memory.
1 parent ca6a9da commit b4b93fc

6 files changed

Lines changed: 16 additions & 7 deletions

File tree

enginescript-variables.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
88

99
# EngineScript Version
10-
VARIABLES_DATE="NOVEMBER 02 2021"
10+
VARIABLES_DATE="DECEMBER 05 2021"
1111

1212
# Software Versions
1313
MARIADB_VER="10.6"
@@ -20,6 +20,9 @@ PHP_VER="8.0"
2020
PHPMYADMIN_VER="5.1.1"
2121
ZLIB_VER="1.2.11"
2222

23+
# Old Software Versions
24+
OLDPHP="8.0"
25+
2326
# EngineScript Variables
2427
BIT_TYPE="$(uname -m)"
2528
CPU_COUNT="$(nproc --all)"
@@ -34,10 +37,12 @@ RAND_CHAR24="$(date +%s | sha256sum | base64 | head -c 24)"
3437
RAND_CHAR32="$(pwgen -1Bcns 32)"
3538
SERVER_MEMORY_TOTAL_01="$(free -m | awk 'NR==2{printf "%d", $2*0.01 }')"
3639
SERVER_MEMORY_TOTAL_02="$(free -m | awk 'NR==2{printf "%d", $2*0.02 }')"
40+
SERVER_MEMORY_TOTAL_03="$(free -m | awk 'NR==2{printf "%d", $2*0.03 }')"
41+
SERVER_MEMORY_TOTAL_05="$(free -m | awk 'NR==2{printf "%d", $2*0.05 }')"
3742
SERVER_MEMORY_TOTAL_06="$(free -m | awk 'NR==2{printf "%d", $2*0.06 }')"
3843
SERVER_MEMORY_TOTAL_07="$(free -m | awk 'NR==2{printf "%d", $2*0.07 }')"
3944
SERVER_MEMORY_TOTAL_12="$(free -m | awk 'NR==2{printf "%d", $2*0.12 }')"
40-
SERVER_MEMORY_TOTAL_55="$(free -m | awk 'NR==2{printf "%d", $2*0.55 }')"
45+
SERVER_MEMORY_TOTAL_50="$(free -m | awk 'NR==2{printf "%d", $2*0.50 }')"
4146
SERVER_MEMORY_TOTAL_80="$(free -m | awk 'NR==2{printf "%d", $2*0.80 }')"
4247
UBUNTU_CODENAME="$(lsb_release -sc)"
4348
UBUNTU_VER="$(lsb_release -sr)"

etc/mysql/mariadb.cnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ max_binlog_size = 100M
106106
default_storage_engine = InnoDB
107107
# you can't just change log file size, requires special procedure
108108
innodb_log_file_size = 128M
109-
innodb_buffer_pool_size = SEDMYSQL55PERCENTM
109+
innodb_buffer_pool_size = SEDMYSQL50PERCENTM
110110
innodb_log_buffer_size = 64M
111111
innodb_file_per_table = 1
112112
innodb_open_files = 400

etc/nginx/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ http {
118118
fastcgi_cache_lock_timeout 5s;
119119
fastcgi_cache_methods GET HEAD;
120120
fastcgi_cache_min_uses 1;
121-
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=EngineScriptWP:100m inactive=1h max_size=300m use_temp_path=off;
121+
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=EngineScriptWP:SEDSERVERMEM03 inactive=45m max_size=SEDSERVERMEM05 use_temp_path=off;
122122
fastcgi_cache_revalidate on;
123123
fastcgi_cache_use_stale error http_500 http_503 invalid_header timeout updating;
124124
fastcgi_cache_valid 200 1h;

scripts/install/mariadb/mariadb-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ y
4949
EOF
5050

5151
# Copy my.cnf file.
52-
# innodb_buffer_pool_size is set to use 55% of total server memory.
52+
# innodb_buffer_pool_size is set to use 50% of total server memory.
5353
# If you wish to dedicate more, change it in /etc/mysql/my.cnf
5454
systemctl stop mariadb.service
5555
mv /var/lib/mysql/ib_log* /root
5656
cp -rf /usr/local/bin/enginescript/etc/mysql/mariadb.cnf /etc/mysql/mariadb.cnf
57-
sed -i "s|SEDMYSQL55PERCENT|${SERVER_MEMORY_TOTAL_55}|g" /etc/mysql/mariadb.cnf
57+
sed -i "s|SEDMYSQL50PERCENT|${SERVER_MEMORY_TOTAL_50}|g" /etc/mysql/mariadb.cnf
5858
systemctl start mariadb.service
5959

6060
echo ""

scripts/install/nginx/nginx-misc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ fi
2727
# Retrieve EngineScript Nginx Configuration
2828
cp -a /usr/local/bin/enginescript/etc/nginx/. /etc/nginx/
2929

30+
# Tune FastCGI Cache
31+
sed -i "s|SEDSERVERMEM03|${SERVER_MEMORY_TOTAL_03}|g" /etc/nginx/nginx.conf
32+
sed -i "s|SEDSERVERMEM05|${SERVER_MEMORY_TOTAL_05}|g" /etc/nginx/nginx.conf
33+
3034
# Assign Permissions
3135
chown -R www-data:www-data /etc/nginx
3236
chown -R www-data:www-data /usr/lib/nginx/modules

scripts/install/redis/redis-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ chown -R redis:redis /run/redis
3838
chown -R redis:redis /var/log/redis
3939

4040
cp -rf /usr/local/bin/enginescript/etc/redis/redis.conf /etc/redis/redis.conf
41-
sed -i "s|SEDREDISMAXMEM|${SERVER_MEMORY_TOTAL_07}|g" /etc/redis/redis.conf
41+
sed -i "s|SEDREDISMAXMEM|${SERVER_MEMORY_TOTAL_06}|g" /etc/redis/redis.conf
4242
chown -R redis:redis /etc/redis/redis.conf
4343
service redis-server restart
4444
sudo systemctl enable redis-server

0 commit comments

Comments
 (0)