Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

10/23/2020

Reading time:N/A min

DataStax-Examples/concurrent-requests-nodejs

by DataStax-Examples

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 hereObjectivesHow to limit async concurrent requests using the Node.js DataStax DriverProject Layoutexecute-concurrent-builtin-way.js: Inserts multiple rows in a table from an Array using the driver's built-in method executeConcurrent()execute-concurrent-promise-way.js: Inserts multiple rows in a table from an Array using PromisesHow this WorksThe Node.js programs write rows to the database asynchronously while limiting the amount of concurrent requests in flight.Setup & RunningSetupMake sure Cassandra Node.js Driver is installednpm install cassandra-driverRunningexecute-concurrent-builtin-way.jsnode execute-concurrent-builtin-way.js <database-ip> <datacenter-name> <concurrency-level>execute-concurrent-promise-way.jsnode execute-concurrent-promise-way.js <database-ip> <datacenter-name> <concurrency-level>

Illustration Image

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>

Related Articles

api.management
node
api

LoopBack

John Doe

3/7/2024

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

node