whatyouhide / xandra

Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.
ISC License
406 stars 54 forks source link

Increase network buffer size #362

Closed whatyouhide closed 7 months ago

whatyouhide commented 7 months ago
          I have another facet to the performance regressions in .18.  Let me know if this should be a separate issue.

The performance of large result sets has significantly worsened. One of the ones I'm looking at is about 100% slower, going from 400ms to 800ms.

I believe this is because the new connection code uses active mode sockets and by default is receiving something like a single packet of data per message (byte_size says about 1400). For each tiny message, we append it into the buffer and try to parse a frame from it.

I experimented a bit and while I don't know if this is the right way to solve this, if I set the buffer option on the transport options to some large number, it fixes the performance degredation.

For instance

Transport.setopts(data.transport, active: :once, buffer: 50000)

Thoughts?

Originally posted by @kennethito in https://github.com/whatyouhide/xandra/issues/357#issuecomment-2053441538