A few other solutions you can look into:
- pouchdb-dump-cli and pouchdb-load - dump a database and load it into PouchDB:
https://github.com/nolanlawson/pouchdb-dump-cli- SQLite Plugin 2 + node-websql - you can use the node-websql adapter to prebuild a PouchDB database into a .db file, and then use SQLite Plugin 2 to load the prepopulated database at startup. this is even faster than the pouchdb-load method, because the database is already built up:
https://github.com/nolanlawson/node-websqlSlow replication, in general, is an issue that the Couch/Pouch community is well aware of. It should be fixed in CouchDB 2.0 and 1.7 with the introduction of the new _bulk_get endpoint. This endpoint is already available in PouchDB Server if you want to try it out (the PouchDB replicator will use it automatically).
Dale is right that auto_compaction can decrease the overhead of storing revisions (since only the winning revision is stored), but the above methods will probably do the most to improve your current performance problems.
Also FWIW CouchDB/PouchDB is probably not a database I would recommend for building a chat application, as you will have trouble scaling it unless you use filtered replication to trim old messages (which is probably most efficient to do serverside, by the way, using separate CouchDB databases, i.e. do filtered replication from big database A to smaller database B, then replicate B to the device, and maybe change B every day so it only contains the most recent messages).
As a temporary workaround, you can simply use PouchDB to query the _changes feed from the remote CouchDB and then store that locally (using any old database, not necessarily PouchDB), then blow it away every day to remove old messages. In the future we will implement the purge() function which will make trimming old documents much easier, but for now it doesn't exist.
In short: you have lots of options here. :)
- Nolan