This example shows how execute multiple concurrent requests asynchronously with Apache Cassandra™ using the Node.js DataStax Driver.

Contributor(s): Jorge Bay Gondra - derived from here

Objectives

  • How to limit async concurrent requests using the Node.js DataStax Driver

Project Layout

How this Works

The Node.js programs write rows to the database asynchronously while limiting the amount of concurrent requests in flight.

Setup & Running

Setup

Make sure Cassandra Node.js Driver is installed

npm install cassandra-driver

Running

  • execute-concurrent-builtin-way.js
node execute-concurrent-builtin-way.js <database-ip> <datacenter-name> <concurrency-level>
  • execute-concurrent-promise-way.js
node execute-concurrent-promise-way.js <database-ip> <datacenter-name> <concurrency-level>