From 1f3f96784b46ed5eddbfee63870ed7d816585bf2 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 24 Sep 2014 15:38:17 +0530 Subject: [PATCH] RAM based optimization done --- src/lib/ee_lib_ram.sh | 2 +- src/modules/stack/install/ee_mod_setup_php.sh | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lib/ee_lib_ram.sh b/src/lib/ee_lib_ram.sh index 3144140d..a6b24461 100644 --- a/src/lib/ee_lib_ram.sh +++ b/src/lib/ee_lib_ram.sh @@ -42,4 +42,4 @@ function ee_lib_ram() EE_MEMCACHE_SIZE="2048" EE_PHP_MAX_CHILDREN="100" fi -} \ No newline at end of file +} diff --git a/src/modules/stack/install/ee_mod_setup_php.sh b/src/modules/stack/install/ee_mod_setup_php.sh index 944ae0d4..3e477c83 100644 --- a/src/modules/stack/install/ee_mod_setup_php.sh +++ b/src/modules/stack/install/ee_mod_setup_php.sh @@ -31,7 +31,7 @@ function ee_mod_setup_php() # Adjust php5-fpm pool sed -i "s/;pm.max_requests/pm.max_requests/" /etc/php5/fpm/pool.d/www.conf - sed -i "s/pm.max_children = 5/pm.max_children = 100/" /etc/php5/fpm/pool.d/www.conf + sed -i "s/pm.max_children = 5/pm.max_children = ${EE_PHP_MAX_CHILDREN}/" /etc/php5/fpm/pool.d/www.conf sed -i "s/pm.start_servers = 2/pm.start_servers = 20/" /etc/php5/fpm/pool.d/www.conf sed -i "s/pm.min_spare_servers = 1/pm.min_spare_servers = 10/" /etc/php5/fpm/pool.d/www.conf sed -i "s/pm.max_spare_servers = 3/pm.max_spare_servers = 30/" /etc/php5/fpm/pool.d/www.conf @@ -66,5 +66,16 @@ function ee_mod_setup_php() wget -qO /usr/share/GeoIP/GeoLiteCity.dat.gz /usr/share/GeoIP/GeoIPCity.dat http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gunzip /usr/share/GeoIP/GeoLiteCity.dat.gz mv /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat - fi + + # Setup Zend OpCache as per RAM + grep memory_consumption /etc/php5/fpm/conf.d/05-opcache.ini &> /dev/null + if [ $? -ne 0]; then + sed -i "s/zend_extension=opcache.so/zend_extension=opcache.so\nopcache.memory_consumption=${EE_OPCACHE_SIZE}\nopcache.max_accelerated_files=50000/" /etc/php5/fpm/conf.d/05-opcache.ini \ + || ee_lib_error "Unable to change opcache.memory_consumption, exit status = " $? + fi + + # Setup PHP Memcache as per RAM + sed "s/-m.*/-m ${EE_MEMCACHE_SIZE}/" /etc/memcached.conf \ + || ee_lib_error "Unable to change Memcache memory value, exit status = " $? + fi }