Спасибо @ikarpovich за то что подсказал откуда запускается скрипт оптимизации в виртуальной машине VMBitrix.
Cкрипт оптимизации в VMBitrix запускается из файла: /etc/rc2.d/S16bvat .
На случай если его оттуда перенесут выкладываю его тут:
#!/bin/sh
#====================================================================
# Run level information:
#
# chkconfig: 2345 16 16
# description: Bitrix Virtual Appliance Tuning & Configuration Script
# processname: bvat
case "$1" in
start|"")
#touch /root/bvat
if [ -f /proc/user_beancounters ] ; then
is_vps=1
if [ `free | grep Mem | awk '{print $2}'` -gt 2000000 ]; then
mem4kblock=`cat /proc/user_beancounters |grep vmguarpages|awk '{print $4}'`
memory=`echo "${mem4kblock} * 4"|bc`
else
memory=`free | grep Mem | awk '{print $2}'`
fi
else
is_vps=0
memory=`free | grep Mem | awk '{print $2}'`
fi
#echo ${memory}
#echo ${is_vps}
mkdir -p /etc/mysql/conf.d >/dev/null 2>&1
mkdir -p /etc/apache2/conf.d >/dev/null 2>&1
if test ${is_vps} -eq 1 ; then
test ${memory} -gt 500000 && { echo "
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 4
MaxSpareServers 4
MaxClients 4
MaxRequestsPerChild 100
</IfModule>" > /etc/apache2/conf.d/prefork ; ln -sf /etc/init.d/xmpp /etc/rc2.d/S92xmpp >/dev/null 2>&1 ; } || { echo "
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 2
MaxRequestsPerChild 100
</IfModule>" > /etc/apache2/conf.d/prefork ; rm -f /etc/rc2.d/S92xmpp >/dev/null 2>&1 ; }
test ${memory} -gt 500000 && { echo "
[mysqld]
query_cache_size=32M
innodb_buffer_pool_size=64M
max_connections = 10
table_cache=4048
thread_cache_size=8
max_heap_table_size=16M
tmp_table_size=16M
key_buffer = 8M
bulk_insert_buffer_size = 1M
myisam_sort_buffer_size = 4M
" > /etc/mysql/conf.d/bvat.cnf ; } || { echo "
[mysqld]
query_cache_size=16M
innodb_buffer_pool_size=32M
max_connections = 10
table_cache=2048
thread_cache_size=8
max_heap_table_size=8M
tmp_table_size=8M
key_buffer = 4M
bulk_insert_buffer_size = 1M
myisam_sort_buffer_size = 2M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 1000000 && { echo "
[mysqld]
query_cache_size=64M
innodb_buffer_pool_size=128M
max_connections = 20
table_cache=4048
thread_cache_size=16
max_heap_table_size=16M
tmp_table_size=16M
key_buffer = 8M
bulk_insert_buffer_size = 2M
myisam_sort_buffer_size = 8M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 2000000 && { echo "
[mysqld]
query_cache_size=128M
innodb_buffer_pool_size=256M
max_connections = 20
table_cache=4048
thread_cache_size=16
max_heap_table_size=16M
tmp_table_size=16M
key_buffer = 8M
bulk_insert_buffer_size = 2M
myisam_sort_buffer_size = 8M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 500000 && { sed "s/memory_consumption\=[0-9]*/"memory_consumption=64"/g" /usr/local/zend/etc/conf.d/optimizerplus.ini > /usr/local/zend/etc/conf.d/optimizerplus.ini_; mv /usr/local/zend/etc/conf.d/optimizerplus.ini_ /usr/local/zend/etc/conf.d/optimizerplus.ini ;} || { sed "s/memory_consumption\=[0-9]*/"memory_consumption=40"/g" /usr/local/zend/etc/conf.d/optimizerplus.ini > /usr/local/zend/etc/conf.d/optimizerplus.ini_; mv /usr/local/zend/etc/conf.d/optimizerplus.ini_ /usr/local/zend/etc/conf.d/optimizerplus.ini ;}
test ${memory} -gt 1000000 && { sed "s/memory_consumption\=[0-9]*/"memory_consumption=128"/g" /usr/local/zend/etc/conf.d/optimizerplus.ini > /usr/local/zend/etc/conf.d/optimizerplus.ini_; mv /usr/local/zend/etc/conf.d/optimizerplus.ini_ /usr/local/zend/etc/conf.d/optimizerplus.ini ;}
else
test ${memory} -gt 250000 && { echo "
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 4
MaxSpareServers 4
MaxClients 4
MaxRequestsPerChild 200
</IfModule>" > /etc/apache2/conf.d/prefork ; ln -sf /etc/init.d/xmpp /etc/rc2.d/S92xmpp >/dev/null 2>&1 ; } || { echo "
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 2
MaxRequestsPerChild 100
</IfModule>" > /etc/apache2/conf.d/prefork ; rm -f /etc/rc2.d/S92xmpp >/dev/null 2>&1 ; }
test ${memory} -gt 1000000 && { echo "
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 10
MaxSpareServers 10
MaxClients 10
MaxRequestsPerChild 500
</IfModule>" > /etc/apache2/conf.d/prefork ; }
test ${memory} -gt 250000 && { echo "
[mysqld]
query_cache_size=32M
innodb_buffer_pool_size=32M
" > /etc/mysql/conf.d/bvat.cnf ; } || { echo "
[mysqld]
query_cache_size=16M
innodb_buffer_pool_size=24M
max_connections = 5
table_cache=1024
thread_cache_size=5
max_heap_table_size=8M
tmp_table_size=8M
key_buffer = 2M
bulk_insert_buffer_size = 1M
myisam_sort_buffer_size = 2M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 500000 && { echo "
[mysqld]
query_cache_size=48M
innodb_buffer_pool_size=96M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 1000000 && { echo "
[mysqld]
query_cache_size=64M
innodb_buffer_pool_size=256M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 2000000 && { echo "
[mysqld]
query_cache_size=128M
innodb_buffer_pool_size=512M
" > /etc/mysql/conf.d/bvat.cnf ; }
test ${memory} -gt 250000 && { sed "s/memory_consumption\=[0-9]*/"memory_consumption=64"/g" /usr/local/zend/etc/ext.d/optimizerplus.ini > /usr/local/zend/etc/ext.d/optimizerplus.ini_; mv /usr/local/zend/etc/ext.d/optimizerplus.ini_ /usr/local/zend/etc/ext.d/optimizerplus.ini ;} || { sed "s/memory_consumption\=[0-9]*/"memory_consumption=40"/g" /usr/local/zend/etc/ext.d/optimizerplus.ini > /usr/local/zend/etc/ext.d/optimizerplus.ini_; mv /usr/local/zend/etc/ext.d/optimizerplus.ini_ /usr/local/zend/etc/ext.d/optimizerplus.ini ;}
test ${memory} -gt 1000000 && { sed "s/memory_consumption\=[0-9]*/"memory_consumption=128"/g" /usr/local/zend/etc/ext.d/optimizerplus.ini > /usr/local/zend/etc/ext.d/optimizerplus.ini_; mv /usr/local/zend/etc/ext.d/optimizerplus.ini_ /usr/local/zend/etc/ext.d/optimizerplus.ini ;}
fi
sed "s/obfuscation_level_support\=[0-9]*/"obfuscation_level_support=1"/g" /usr/local/zend/etc/ext.d/loader.ini > /usr/local/zend/etc/ext.d/loader.ini_; mv -f /usr/local/zend/etc/ext.d/loader.ini_ /usr/local/zend/etc/ext.d/loader.ini
test -z "`grep "ulimit -n 10240" /lib/lsb/init-functions`" && echo "
ulimit -n 10240
" >> /lib/lsb/init-functions
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
esac
exit 0