bos / pool

A high-performance striped resource pooling implementation for Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about stripped pools

wmoss opened this issue · comments

Hey Bryan,

I noticed this here and in your pool in the Riak bindings, but what's the benefit of stripping pools? Why have 10 local pools of 20 connections instead of one pool of 200 connections?

Thanks,
Will

I'm not Bryan, obviously, but I will try to answer your question.

First, a little nitpick: I't "striped", not "stripped". I think in this context it means "several pools parallel to each other".

The reason to use several local pools is one of synchronization: Software transactional memory (STM) is used to get a resource out of the pool and put it back in. That means if you have high-frequency access to your resources, you might have many synchronization-conflicts and thus many STM-retrys. These, in turn, may slow your program down or even stall it.

The striping, several parallel local pools, reduces the probability of conflicts by distributing access to the resources onto several independently synchronized local pools.

Yes, this is exactly the reason. Thanks for the answer!