High CPU utilization when using asyncore event loop

Description

I don't have gevent or libev installed. Following code is run in my Python shell:

> from cassandra.cluster import Cluster
> cluster = Cluster(protocol_version=1)
> session = cluster.connect(keyspace='foo_keyspace')

I monitored CPU utilization via htop, and I found Python process started using CPU constantly as the connection establised. It seems AsyncoreConnection is looping in a high frequency for events under the hoop. This caused a high load average on my server.
As I don't see any documentation mention about this(sorry if I miss something), I'd like to ask is it a known issue when using asyncore for event loop?

Environment

ubuntu12.04, cassandra 1.2.6

Pull Requests

None

Activity

Show:

Greg Bestland May 13, 2016 at 4:19 PM

I'm not going to add a integration test around performance, as those tend to be extremely fragile.
I was able to reproduce the issue prior to the change, after the change it looks to be much improved.
I don't see any regressions related to this change I'm moving it to done.

Adam Holmberg April 26, 2016 at 10:07 PM

I have a PR up for review. I will be returning to this tomorrow to write a bit about how I landed on this solution and what the perf impact will be.

Adam Holmberg March 18, 2015 at 8:21 PM

Thanks for brining this up. It is a known, but not well-documented issue.
https://groups.google.com/a/lists.datastax.com/d/topic/python-driver-user/-UA_oadNYk0/discussion

I'll use this ticket to look into it further, and document if/why it can't be improved.

Fixed

Details

Assignee

Reporter

Fix versions

Reproduced in

Sprint

Affects versions

Priority

Created March 18, 2015 at 5:36 AM
Updated May 13, 2016 at 4:19 PM
Resolved May 13, 2016 at 4:19 PM