sumeet avatar image
sumeet asked Erick Ramirez answered

Java driver has high CPU usage when making parallel calls

Hi Team , We are using Asta DB and Java Casssandra java driver 4.13 to connect .

We are running spring boot http server with 2 GB memory depolyed in pivotal cloud having 16 Core CPU. On doing 10 parallel call we had observed high cup usage on s0-io threads and it results in overall cpu spike .

The CQL query is hitting partion key and fetching 250 rows each having 25 columns.

CompletionStage<AsyncResultSet> stage = cqlSession.executeAsync(bound);
    return stage.thenComposeAsync(RowCollector::new)
            .thenApplyAsync(rows ->

private static class RowCollector extends CompletableFuture<List<Row>> {
  final List<Row> rows = new ArrayList<>();
  RowCollector(AsyncResultSet first) {
  void consumePage(AsyncResultSet page) {
    for (Row row : page.currentPage()) {
    if (page.hasMorePages()) {
    } else {


java driverastra db
1649557515608.png (45.7 KiB)
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

There isn't anything in what you posted that is obvious to indicate that there's a problem. It is normal to have multiple IO threads since the driver connects to the nodes in the cluster and they would be consuming CPU cycles if they are actively serving requests.

As a general recommendation, you will get better performance by deploying multiple clients/app instances compared to just one instance since it is able to maximise the throughput of your cluster.

Note that if you're connecting to an Astra DB instance on the free tier, it will be limited to 4,000 operations per second. If you are on a paid tier, you can request for the limit to be raised by logging a support ticket.

If you haven't already seen them, I'd recommend having a look at the following references:


10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.