Add 'hostPoolSize' option to ConnectionPool #70

merged 4 commits into from Sep 27, 2012


None yet
2 participants

hpainter commented Sep 13, 2012

Small modification that allows the number connections per cluster host to be increased. Similar to the node-postgres module, which uses a pool of 10 'parallel' connections to the db, bumpng this number up increased the throughput of our app which was making a lot of asynchronous read requests to the cassandra db.

Justin Painter Add 'hostPoolSize' option to ConnectionPool.
Allows the number of connections per host to be modified.  Defaults
to 1 if not specified.

devdazed commented Sep 13, 2012

Awesome, commit. I've been meaning to do this [ ref #21 ]. The only thing I ask before I pull is that a test get written for it. I want to ensure we don't break existing functionality.

Justin Painter Move counter var initialization.
Fixes a bug where doing the counter initialization up top prevented
connections to hosts after the first one.

hpainter commented Sep 18, 2012

I'll see if I can get some test coverage for this. I noticed that if I set multiple hosts in tests/helpers/connection.js it causes some tests to fail, and I suspect I can get a fix for that in with this as well.

Justin Painter added some commits Sep 18, 2012

Justin Painter Move onConnect callback from first to final connection.
In ConnectionPool.connect(), if the callback gets fired after making the
first successfull connection then subsequent ConnectionPool.use() calls may
not set the keyspace on the entire set of connections.  This moves the
callback to happen after the final connection is set.
Justin Painter Test suite for ConnectionPools that use hostPoolSize option.
Re-runs the existing thrift.js test suite, but sets the
hostPoolSize option before starting.

hpainter commented Sep 18, 2012

OK, tests are ready and passing. The current suite of thrift.js tests just get imported and re-run with the hostPoolSize option set. Let me know if you see any issues...

@devdazed devdazed added a commit that referenced this pull request Sep 27, 2012

@devdazed devdazed Merge pull request #70 from getloaded/host-pool
Add 'hostPoolSize' option to ConnectionPool

@devdazed devdazed merged commit 6975cd0 into simplereach:master Sep 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment