简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM