kclay / rethink-scala

Scala Driver for RethinkDB
Other
100 stars 24 forks source link

Shrink connection pool under low load #20

Open mick-h opened 9 years ago

mick-h commented 9 years ago

Load testing in a Play app showed that once the pool opens new connections to deal with the load, it does not close them when the load abates. To load test I used siege: siege -c 200 -t 3m http://localhost:10000/...

and to view open connections I use lsof: watch -n 5 "sudo lsof | grep rethink | grep 28015"

kclay commented 9 years ago

What sort of features/configurable should this have?

mick-h commented 9 years ago

In terms of config, starting pool size, minimum pool size, maximum open connections. In terms of logic, begin with starting pool size connections open. As connections are borrowed, if the number of available connections drops below minimum pool size connections, start creating new ones, up until maximum open connections. When connections are returned to the pool, if the pool size is larger than starting pool size, close the connections. That would be my approach.