Slow queries (only when using python driver)

70 views
Skip to first unread message

Martin Brambati

unread,
Nov 26, 2014, 3:07:53 PM11/26/14
to python-dr...@lists.datastax.com
Hi there, I'm using the python driver for a django app. My column_family has 1M registries aprox. 
Each simple query takes 10 secs and it's a simple one, by PK should't take so long. When I execute the query via cqlsh it takes a few miliseconds, very fast.

This is the method where I try to execute the query:

def execute(self, cql, kargs):
            res = self.get_session().execute(cql, kargs)
            return res


and the query looks like:

select * keyspace.from cfname where id=12334343;

Thanks!

Adam Holmberg

unread,
Dec 9, 2014, 6:36:48 PM12/9/14
to python-dr...@lists.datastax.com
I don't see anything unusual with the small amount of Python you showed. Curious, what's inside of 'self.get_session()'?

I'm assuming the malformed query is just a typo.

We may need a little more information about your Cassandra/cqlsh and driver versions, data model, and surrounding code, to help out.

Regards,
Adam Holmberg

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Martin Brambati

unread,
Dec 10, 2014, 7:54:53 AM12/10/14
to python-dr...@lists.datastax.com
We just found out the problem (I think), had to add max_schema_agreement_wait=0.01 on initialize... that helped with speed, also we configured cluster.set_core_connections_per_host(HostDistance.LOCAL, 1).

The problem is the connect, each connect takes more than 10 secs...

The malformed query is just a typo :P
--
Martin Brambati
Engineering / Mendoza / Argentina

Adam Holmberg

unread,
Dec 10, 2014, 10:52:44 AM12/10/14
to python-dr...@lists.datastax.com
max_schema_agreement_wait only comes into play when modifying schema. Are you changing schema often?

Regarding connect time: 10s is surprisingly high. Independent of possible network issues, this should not really affect a discussion of query execution if your session is long-lived (i.e. you would not typically be creating many sessions in an application).

Adam

Martin Brambati

unread,
Dec 10, 2014, 11:33:52 AM12/10/14
to python-dr...@lists.datastax.com
Yes, one session only (Singleton), and I really don't know why it takes so long. The initial topic should be changed to "cluster.connect speed problem".

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.
Reply all
Reply to author
Forward
0 new messages