Hi Tarun,

There are a ton of factors that can impact query performance.

The cassandra native protocol supports multiple simultaneous requests per
connection.  Most drivers by default only create one connection to each C*
host in the local data center.  That being said, that shouldn't be a
problem, particularly if you are only executing 20 concurrent requests,
this is something both driver clients and C* handles well.  The driver does
do some write batching to reduce the amount of system calls, but I'm
reasonably confident this is not an issue.

It may be worth enabling client logging
<https://github.com/datastax/nodejs-driver/#logging> to see if that shines
any light.   You can also enable tracing on your requests by specifying
traceQuery
<https://docs.datastax.com/en/developer/nodejs-driver/3.5/api/type.QueryOptions/#type-query-options>
as a query option (example
<https://github.com/datastax/nodejs-driver/blob/master/examples/tracing/retrieve-query-trace.js>)
to see if the delay is caused by C*-side processing.

Also keep in mind that all user code in node.js is handled in a single
thread.  If you have callbacks tied to your responses that do non-trivial
work, that can delay subsequent requests from being processed, which may
give impression that some queries are slow.

Thanks,
Andy

On Sun, Nov 4, 2018 at 8:59 AM Tarun Chabarwal <tarunchabar...@gmail.com>
wrote:

> Hi
>
> I used cassandra driver provided by datastax (3.5.0) library in nodejs.
> I've 5 nodes cluster. I'm writing to a table with quorum.
>
> I observed that there is some spike in write. In ~20 writes, 2-5 writes
> are taking longer(~200ms). I debugged one of the node process with strace
> and found that longer latencies are batched and they use same fd to connect
> to cassandra. This may be the multiplexing.
>
> Why it takes that long ?
> Where should I look to resolve it?
>
> Regards
> Tarun Chabarwal
>

Reply via email to