Skip to content

Commit

Permalink
Use env variables for Unicorn memory limits
Browse files Browse the repository at this point in the history
This makes it easier for users to use their own limits based on their
server configuration.
  • Loading branch information
Yorick Peterse committed Jan 20, 2016
1 parent 481644c commit 21fab4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ if defined?(Unicorn)
# Unicorn self-process killer
require 'unicorn/worker_killer'

min = (ENV['GITLAB_UNICORN_MEMORY_MIN'] || 200 * 1 << 20).to_i
max = (ENV['GITLAB_UNICORN_MEMORY_MAX'] || 250 * 1 << 20).to_i

# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (200 * (1 << 20)), (250 * (1 << 20))
use Unicorn::WorkerKiller::Oom, min, max
end
end

Expand Down
2 changes: 2 additions & 0 deletions doc/administration/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ DATABASE_URL | url | For example: postgresql://localhost/blog_development?pool=5
GITLAB_EMAIL_FROM | email | Email address used in the "From" field in mails sent by GitLab
GITLAB_EMAIL_DISPLAY_NAME | string | Name used in the "From" field in mails sent by GitLab
GITLAB_EMAIL_REPLY_TO | email | Email address used in the "Reply-To" field in mails sent by GitLab
GITLAB_UNICORN_MEMORY_MIN | integer | The minimum memory threshold (in bytes) for the Unicorn worker killer
GITLAB_UNICORN_MEMORY_MAX | integer | The maximum memory threshold (in bytes) for the Unicorn worker killer

## Complete database variables

Expand Down

0 comments on commit 21fab4f

Please sign in to comment.