abernier
abernier

Reputation: 28228

pouchdb replicate from couchdb : very slow

I got a ~10k entries(~30Mo, no attachment) database in my couchDB.

Using Pouchdb browser-side, when replicating from couch, it takes really a while to complete...

What surprise me is the amount of requests my couch receives during it (thousands!, I guess as many as documents) — is that normal ?

Is there a way to "bulk" those requests and generally accelerate the replicating process ?

Thank you.

Upvotes: 6

Views: 1935

Answers (1)

Tom Grant
Tom Grant

Reputation: 428

I assume you're using the PouchDB.replicate function

In that case, try modifying the batch_size option:

PouchDB.replicate('mydb', 'http://localhost:5984/mydb', {batch_size: large_val})

where large_val is higher than the default of 100. The higher the value, the faster the replication should go, but the more memory it will use, so be careful.

See the API reference

Edit: Also note the option batches_limit which defaults to 10. This is how many requests may run in parallel at any time, so the number of documents in memory equals batch_size * batches_limit.

Upvotes: 9

Related Questions