Bulk import in Aerospike using NodeJs

683 Views Asked by At

I'd like to insert millions of records as a batch process from MongoDB to Aerospike. I follow the documentation and found this doc: http://www.aerospike.com/docs/client/nodejs/usage/kvs/write.html but with this only one record can we inserted at a time.

Please help me how I can perform insert over millions of key values at a single time. Any suggestion to optimize write operation

2

There are 2 best solutions below

1
On

Every record write into Aerospike will be a single record write since Aerospike has a record level lock. Don't see how you can write a million records in one operation. Records for a given namespace are distributed evenly across the Aerospike cluster based on a hash of their set name and record key. So writes to the Aerospike cluster from the client side have to be individual record writes.

2
On

Aerospike is a multi-node, multi-core, multithreaded distributed key-value database. If you want to do a large number of write operations in as short amount of time possible, you need to leverage this fact and do your writes in parallel. As Piyush pointed out, each object in itself is written as a single write, so you should be splitting your work across multiple clients and multiple threads in those clients. This is how tools such as aerospike/aerospike-loader and asrestore work.

I've described how it works inside each node in a separate post about Aerospike internals.