added a minimal number of free slots that should always exist

This commit is contained in:
Sam 2013-11-19 14:58:27 +11:00
parent 2841434e36
commit 518ae2c608

View file

@ -7,6 +7,9 @@ module Middleware::UnicornOobgc
MIN_REQUESTS_PER_OOBGC = 3
# TUNE ME, for Discourse this number is good
MIN_FREE_SLOTS = 80_000
def verbose(msg=nil)
@verbose ||= ENV["OOBGC_VERBOSE"] == "1" ? :true : :false
if @verbose == :true
@ -66,6 +69,10 @@ module Middleware::UnicornOobgc
@max_delta = [new_delta, delta].max
end
if @max_delta < MIN_FREE_SLOTS
@max_delta = MIN_FREE_SLOTS
end
if @num_requests > MIN_REQUESTS_PER_OOBGC && @max_delta * 2 + new_live_num > @expect_gc_at
t = Time.now
GC.start