Pouchdb replicate from couchdb: very slow

In my couchDB I got a ~ 10k database (~ 30Mo, no binding).

Using Pouchdb on the browser side, when copying from the couch, it really takes some time to complete ...

What surprises me is the number of requests my couch receives (thousands !, I think, as many as the documents) - is this normal?

Is there a way to โ€œsaturateโ€ these requests and generally speed up the replication process?

Thanks.

+6
source share
1 answer

I assume you are using the PouchDB.replicate function

In this case, try changing the batch_size parameter:

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

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

See API link

Edit: Also pay attention to the batches_limit parameter, which is 10 by default. This is how many requests can be executed in parallel at any time, so the number of documents in memory is batch_size * batches_limit .

+6
source

Source: https://habr.com/ru/post/976744/


All Articles