Skip to content

Instantly share code, notes, and snippets.

@nddeluca
Created June 18, 2014 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nddeluca/d952d316db593a666d27 to your computer and use it in GitHub Desktop.
Save nddeluca/d952d316db593a666d27 to your computer and use it in GitHub Desktop.
#This file is used by Rack-based servers to start the application.
if defined?(Unicorn)
require 'unicorn/oob_gc'
require 'unicorn/worker_killer'
# Prevent garbage collection from running during requests
GC.disable
# Run garbage collection out-of-band every n requests
use(Unicorn::OobGC, 10)
# Minimum and maximum number of requests for a worker
use(Unicorn::WorkerKiller::MaxRequests, 3000, 5000)
# Minimum, maximum, and check frequency for worker memory allocation
use(Unicorn::WorkerKiller::Oom, (712*(1024**2)), (1024**3), 16)
end
# Load rails environment and start the application
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment