Sorry, I mis-typed in my original post, we're using RandomPartitioner (not RandomPlacement ;-)), we're using SimpleStrategy for our placement strategy, and a RF of 3 (and 3 nodes total).
Here's how we're creating the connection pool. We created a wrapper class around PyCassa's ColumnFamily class to handle creation of the connection pool and seamlessly manage cases where we are running unittests locally and might not have connectivity to a Cassandra cluster.
class InternalColumnFamily(ColumnFamily):
def __init__(self, **kwargs):
if 'test' in sys.argv:
# lame attempt at not requiring a local cassandra instance when running tests
pool = pycassa.ConnectionPool('our_test_ks',
timeout=0,
credentials=settings.TEST_CASSANDRA_CREDENTIALS,
prefill=False)
else:
pool = pycassa.ConnectionPool('our_ks',
timeout=5,
credentials=settings.CASSANDRA_CREDENTIALS)
super(InternalColumnFamily, self).__init__(pool, self.column_family, **kwargs)
So the way we use this is we subclass from InternalColumnFamily for each of our column families we use, i.e.:
class StuffColumnFamily(InternalColumnFamily):
column_family = 'stuff'
def __init__(self, **kwargs):
super(StuffColumnFamily, self).__init__(**kwargs)
self.default_validation_class = JsonType() # custom json serializer/deserializer
self.column_name_class = DateType()
We instantiate our subclassed ColumnFamily objects as model objects in a web API, so a pool is created for each API request...
Hopefully we're just doing something obvious... :-P