This example shows how execute multiple concurrent requests asynchronously with Apache Cassandra™ using the Node.js DataStax Driver.
- How to limit async concurrent requests using the Node.js DataStax Driver
- execute-concurrent-builtin-way.js: Inserts multiple rows in a table from an Array using the driver's built-in method
- execute-concurrent-promise-way.js: Inserts multiple rows in a table from an Array using Promises
How this Works
The Node.js programs write rows to the database asynchronously while limiting the amount of concurrent requests in flight.
Setup & Running
Make sure Cassandra Node.js Driver is installed
npm install cassandra-driver
node execute-concurrent-builtin-way.js <database-ip> <datacenter-name> <concurrency-level>
node execute-concurrent-promise-way.js <database-ip> <datacenter-name> <concurrency-level>