devinus / poolboy

A hunky Erlang worker pool factory
http://github.com/devinus/poolboy
ISC License
1.56k stars 348 forks source link

Configurable worker dismiss timeout #49

Closed arjan closed 10 years ago

arjan commented 10 years ago

I would like to have a configurable timeout before an overflow worker is dismissed.

Since starting a worker can be an expensive process (e.g. establishing a db connection), with a certain load on the pool workers are started and stopped continuously, because the waiting queue might be empty but 1msec later it might be filled again. In this case, poolboy would have stopped a worker but milliseconds later need to spin it up again, causing a performance decrease due to the worker startup overhead.

My proposal is to add a timeout so that workers are only dismissed after the timeout has passed and the queue is empty at that point in time.

davidw commented 10 years ago

This sort of idea has been rejected before: https://github.com/devinus/poolboy/issues/30

I'd be interested in a fork of poolboy that pursues this kind of development.

arjan commented 10 years ago

Thanks for the link! This makes a lot of sense to me now, i think I'll be putting more logic in the pool worker