Skip to content

Instantly share code, notes, and snippets.

@beltran
Created June 28, 2017 20:24
Show Gist options
  • Save beltran/e8a254a837cbdd42936e6306beda5ee9 to your computer and use it in GitHub Desktop.
Save beltran/e8a254a837cbdd42936e6306beda5ee9 to your computer and use it in GitHub Desktop.
import time
from ccmlib.cluster import Cluster as CCMCluster
from cassandra.io.asyncorereactor import AsyncoreConnection
from cassandra.io.libevreactor import LibevConnection
from cassandra import ConsistencyLevel
from cassandra.protocol import QueryMessage
import logging
connection_class = AsyncoreConnection
PROTOCOL_VERSION = 4
log = logging.getLogger()
log.setLevel('DEBUG')
def make_request():
query = "SELECT keyspace_name FROM system.schema_keyspaces LIMIT 1"
def cb(*args, **kargs):
pass
conn = connection_class.factory(host='127.0.0.1', timeout=5, protocol_version=PROTOCOL_VERSION)
conn.send_msg( QueryMessage(query=query, consistency_level=ConsistencyLevel.ONE), request_id=0, cb=cb)
conn.close()
connection_class.initialize_reactor()
for _ in range(40000):
make_request()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment