Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

CouchDB - Mobile application architecture - Replication performance

$
0
0

I built a mobile application based on CouchDB.

For security reason, i have to make sure that a document can be read only by the users allowed to do do it. As i cannot manage the access right at document level, i create one couchdb database per user, and i replicate documents from my main couchDB database in each user database with a filtered replication.

This model work very well, but today i faced huge performance issues.

I tried to have all my replications continuous, filtered and bi-directionnal, but after 80 users (so 81 databases and 160 simultanous continuous replications), there was too much replications and my couchDB service start to slow down and even crashed sometimes. Notices that all the databases are on the same server (and i could not have more than one server)

I tried to put in place a "manual" replications, but even this way when i need to replicate a document from my main database to all my 80 users databases, each filtered replication from my main database to a user database take around 30 seconds.

Maybe i have an issue with my replication filter, i store for each document a list of users allowed to see it. As each user has it own database, i replicate only the document the user is allowed to see in its database. Here is my replication function :

function(doc, req) {
  if(doc.userList) {
    if(doc.userList.indexOf(req.query.username) > 1) {
      return true;
    }
  }
  return false;
}

The goal of my application is to get around 1000 users, that is totally impossible with the current architecture / performance.

I have three questions : 1. Even if i think that it's not possible, Is it possible to get about 1000 databases in continuous replication on the same server? 2. Is there anything wrong with my replication filter? Is there any way to improve it to have fast databases replications? 3. If the current architecture is not good at all, what kind of architecture would you advise in my case?

Thank you very much !


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>