diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-03-31 10:31:53 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-03-31 10:31:53 +0300 |
commit | e64702d6f0a8061dc3792e23127161d8e70cdb4c (patch) | |
tree | 18b3a30bed8406c6de6033ba290b06b5850a10ad /workerpool.go | |
parent | server: verify request's 'Connection: close' after request handler returns (diff) | |
download | fasthttp-e64702d6f0a8061dc3792e23127161d8e70cdb4c.tar.gz fasthttp-e64702d6f0a8061dc3792e23127161d8e70cdb4c.tar.bz2 fasthttp-e64702d6f0a8061dc3792e23127161d8e70cdb4c.zip |
workerpool: removed a hack for recycling worker stacks, since Go runtime must be able to shrink big stacks when they aren't needed
Diffstat (limited to 'workerpool.go')
-rw-r--r-- | workerpool.go | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/workerpool.go b/workerpool.go index 0fb6557..ffaf59b 100644 --- a/workerpool.go +++ b/workerpool.go @@ -205,10 +205,7 @@ func (wp *workerPool) workerFunc(ch *workerChan) { wp.lock.Unlock() }() - var ( - connsServed uint64 - err error - ) + var err error for c = range ch.ch { if c == nil { break @@ -227,21 +224,8 @@ func (wp *workerPool) workerFunc(ch *workerChan) { } c = nil - // Recycle workers in order to reduce the amount of memory occupied - // by worker stacks, which could grow due to stack-hungry request handlers. - connsServed++ - if connsServed >= maxConnsPerWorker { - break - } - if !wp.release(ch) { break } } } - -// maxConnsPerWorker is the maximum number of connections each worker may serve. -// -// This setting allows recycling worker stacks, which could grow during -// execution of stack-hungry request handlers provided by users. -const maxConnsPerWorker = 100 |