Merge branch 'somaxconn' into 'master'
Set net.core.somaxconn kernel parameter for unicorn Set net.core.somaxconn kernel parameter to a value equal or higher then unicorn backlog_socket. The default kernel value is 128 which is lower then the default unicorn backlog. Closes gitlab-org/omnibus-gitlab#656 See merge request !405
This commit is contained in:
commit
f147911fd0
|
@ -249,6 +249,8 @@ external_url 'GENERATED_EXTERNAL_URL'
|
|||
# unicorn['pidfile'] = '/opt/gitlab/var/unicorn/unicorn.pid'
|
||||
# unicorn['tcp_nopush'] = true
|
||||
# unicorn['backlog_socket'] = 1024
|
||||
# Make sure somaxconn is equal or higher then backlog_socket
|
||||
# unicorn['somaxconn'] = 1024
|
||||
# We do not recommend changing this setting
|
||||
# unicorn['log_directory'] = "/var/log/gitlab/unicorn"
|
||||
|
||||
|
|
|
@ -208,6 +208,7 @@ default['gitlab']['unicorn']['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/g
|
|||
default['gitlab']['unicorn']['pidfile'] = "#{node['package']['install-dir']}/var/unicorn/unicorn.pid"
|
||||
default['gitlab']['unicorn']['tcp_nopush'] = true
|
||||
default['gitlab']['unicorn']['backlog_socket'] = 1024
|
||||
default['gitlab']['unicorn']['somaxconn'] = 1024
|
||||
default['gitlab']['unicorn']['worker_timeout'] = 60
|
||||
default['gitlab']['unicorn']['worker_memory_limit_min'] = "200*(1024**2)"
|
||||
default['gitlab']['unicorn']['worker_memory_limit_max'] = "250*(1024**2)"
|
||||
|
|
|
@ -20,3 +20,33 @@ unicorn_service 'unicorn' do
|
|||
rails_app 'gitlab-rails'
|
||||
user node['gitlab']['user']['username']
|
||||
end
|
||||
|
||||
if File.directory?("/etc/sysctl.d") && File.exists?("/etc/init.d/procps")
|
||||
# smells like ubuntu...
|
||||
service "procps" do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template "/etc/sysctl.d/90-unicorn.conf" do
|
||||
source "90-unicorn.conf.sysctl.erb"
|
||||
owner "root"
|
||||
mode "0644"
|
||||
variables(node['gitlab']['unicorn'].to_hash)
|
||||
notifies :start, 'service[procps]', :immediately
|
||||
end
|
||||
else
|
||||
# hope this works...
|
||||
execute "sysctl" do
|
||||
command "/sbin/sysctl -p /etc/sysctl.conf"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
bash "add somaxconn settings" do
|
||||
user "root"
|
||||
code <<-EOF
|
||||
echo 'net.core.somaxconn = #{node['gitlab']['unicorn']['somaxconn']}' >> /etc/sysctl.conf
|
||||
EOF
|
||||
notifies :run, 'execute[sysctl]', :immediately
|
||||
not_if "egrep '^net.core.somaxconn = ' /etc/sysctl.conf"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# This file is managed by gitlab-ctl. Manual changes will be
|
||||
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
|
||||
# and run `sudo gitlab-ctl reconfigure`.
|
||||
#
|
||||
# gitlab somaxconn kernel tweak for unicorn
|
||||
#
|
||||
# make sure this value is equal or higher then unicorn backlog_socket
|
||||
net.core.somaxconn = <%= node['gitlab']['unicorn']['somaxconn'] %>
|
Loading…
Reference in New Issue