aajtodd/dbperf

Benchmark mutex based implementation

Opened this issue · 0 comments

The initial worker pool implementation is based on Go channels. For this particular use case we may be better off with a mutex based implementation.

The primary reasoning would be because buffered channels require a priori knowledge about the expected channel usage (e.g. how many jobs per worker are going to be generated). Currently the job queue size is set to a constant value with the hope that it is large enough to not run into any adverse situations (e.g. large number of queries pinned to a single worker such that we starve other workers that could otherwise be making progress).

Additionally, as an anecdote, the current implementation took more time than it should have due to subtle deadlock issues with buffered channels (e.g. not allocating the result channel to be large enough). I'm sure a mutex implementation, while not as idiomatic Go perhaps, would have been simpler.