add load-balancing for php7.3

This commit is contained in:
VirtuBox
2019-03-20 03:21:39 +01:00
parent 02b5eebc37
commit 9c693724b5
3 changed files with 25 additions and 6 deletions

View File

@@ -882,10 +882,10 @@ class WOStackController(CementBaseController):
config['www']['ping.path'] = '/ping'
config['www']['pm.status_path'] = '/status'
config['www']['pm.max_requests'] = '1500'
config['www']['pm.max_children'] = '100'
config['www']['pm.start_servers'] = '20'
config['www']['pm.min_spare_servers'] = '10'
config['www']['pm.max_spare_servers'] = '30'
config['www']['pm.max_children'] = '50'
config['www']['pm.start_servers'] = '10'
config['www']['pm.min_spare_servers'] = '5'
config['www']['pm.max_spare_servers'] = '15'
config['www']['request_terminate_timeout'] = '300'
config['www']['pm'] = 'ondemand'
config['www']['chdir'] = '/'
@@ -897,6 +897,20 @@ class WOStackController(CementBaseController):
Log.debug(self, "writting PHP 7.3 configuration into "
"/etc/php/7.3/fpm/pool.d/www.conf")
config.write(configfile)
# Generate /etc/php/7.3/fpm/pool.d/www-two.conf
WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf",
"/etc/php/7.3/fpm/pool.d/www-two.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/"
"www-two.conf", "[www]", "[www-two]")
config = configparser.ConfigParser()
config.read('/etc/php/7.3/fpm/pool.d/www-two.conf')
config['www-two']['listen'] = 'php73-two-fpm.sock'
with open('/etc/php/7.3/fpm/pool.d/www-two.conf',
encoding='utf-8', mode='w') as confifile:
Log.debug(self, "writting PHP7.3 configuration into "
"/etc/php/7.3/fpm/pool.d/www-two.conf")
config.write(confifile)
# Generate /etc/php/7.3/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf",

View File

@@ -50,7 +50,12 @@ server 127.0.0.1:9172;
# PHP 7.3 upstream with load-balancing on two unix sockets
upstream php73 {
least_conn;
server unix:/var/run/php/php73-fpm.sock;
server unix:/var/run/php/php73-two-fpm.sock;
keepalive 5;
}
# PHP 7.3 debug