Read multiple rows faster than iter method

22 views
Skip to first unread message

Hardik Madhu

unread,
Mar 9, 2024, 3:07:59 PM3/9/24
to gocql
Hi All,

Total Go noob here!!!

Context: We have python app already running on production, but trying to migrate to Go for improved performance and better scalability.

We always need to read upwards of 20 rows at a time, max 60, median is in 30 to 40 range. Python Datastax cassandra drivers' documentation provides a pretty good mechanism for doing these queries - link. With execute async, and callback, we're able query the data with very little additional penalty. i.e. if the Cassandra server took ~40ms to respond, we would have the data in ~50ms. 

I'm trying to do the same queries in go with the iter() method and I see latency in the range of 80-110ms. My go implementation is based on the pagination example. This difference is a quite huge for us, every millisecond counts!! I wonder if this is because of the iterative - fetchOne - nature of the code.

Tried many different things, but I didn't find anything close to execute_async() / fetchall() on a low level yet. Closest I found is "BindMap" on scylla/gosqlx, but it requires quite a lot of setup, and I'm not sure it'll be helpful at the end. Being a complete go newbie i'm not sure what to even "search" for. I would also be more than happy to implement something low level using go routines, but not sure how to go about that either. 

Thanks in advanced!

Best,
Hardik
Reply all
Reply to author
Forward
0 new messages