Raise number of nailgun uWSGI workers and sockets

Fixes issue where nailgun stops responding to requests
because all workers are occupied and the queue of
available uWSGI sockets fills up by increasing the
number of workers (double) and raising the connection
limit from 100 to 4096.

This requires a kernel setting of net.core.somaxconn, which
is now being applied on Fuel Master host because it cannot
be done on an unprivileged Docker container.

Change-Id: Ib25d45c75c34a71b24fe620bf1077f71c2b8af6d
Closes-Bug: #1391935
This commit is contained in:
Matthew Mosesohn 2014-11-17 20:21:55 +04:00
parent 8a0ceff907
commit 7cec9cc552
3 changed files with 13 additions and 3 deletions

View File

@ -124,6 +124,7 @@ class { "nailgun::venv":
dns_domain => $::fuel_settings['DNS_DOMAIN'],
}
class { 'nailgun::uwsgi':
production => $production,
}
class { "nailgun::client":
server => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],

View File

@ -5,12 +5,21 @@
# === Parameters
#
class nailgun::uwsgi(
$production,
) {
if $::physicalprocessorcount > 8 {
if $::physicalprocessorcount > 4 {
$physicalprocessorcount = 8
} else {
$physicalprocessorcount = $::physicalprocessorcount
$physicalprocessorcount = $::physicalprocessorcount * 2
}
if $production == "docker-build" {
$somaxconn = "100"
} else {
#Increase max connections for sockets for Nailgun uWSGI
$somaxconn = "4096"
sysctl::value{'net.core.somaxconn': value => $somaxconn}
}
package { ['uwsgi', 'uwsgi-plugin-common', 'uwsgi-plugin-python']:
@ -32,7 +41,6 @@ class nailgun::uwsgi(
group => 'root',
mode => '0644',
}
Class[Nailgun::Venv]->
File['/etc/nailgun/uwsgi_nailgun.yaml']

View File

@ -11,5 +11,6 @@ uwsgi:
virtualenv: <%= @venv %>
module: nailgun.wsgi
buffer-size: 49180
listen: <%= @somaxconn %>
pidfile: /tmp/nailgun.pid
logto: /var/log/nailgun/app.log