One of the features of CouchDB, which doesn't map cleanly into FoudationDB is 
changes feed. The essence of the feature is: 
- Subscriber of the feed wants to receive notifications when database is 
updated. 
- The notification includes update_seq for the database and list of changes 
which happen at that time. 
- The change itself includes docid and rev. 
Hi, 

There are multiple ways to easily solve this problem. Designing a scalable way 
to do it is way harder.  

There are at least two parts to this problem:
- how to structure secondary indexes so we can provide what we need in 
notification event
- how to notify CouchDB about new updates

For the second part of the problem we could setup a watcher on one of the keys 
we have to update on every transaction. For example the key which tracks the 
database_size or key which tracks the number of documents or we can add our own 
key. The problem is at some point we would hit a capacity limit for atomic 
updates of a single key (FoundationDB doesn't redistribute the load among 
servers on per key basis). In such case we would have to distribute the counter 
among multiple keys to allow FoundationDB to split the hot range. Therefore, we 
would have to setup multiple watches. FoundationDB has a limit on the number of 
watches the client can setup (100000 watches). So we need to keep in mind this 
number when designing the feature. 

The single key update rate problem is very theoretical and we might ignore it 
for the PoC version. Then we can measure the impact and change design 
accordingly. The reason I decided to bring it up is to see maybe someone has a 
simple solution to avoid the bottleneck. 

best regards,
iilyak

Reply via email to