I'm creating a web API service that manages friends list and leadersboards.
When user requests leadersboard, server returns only user's friends' ranking and scores.
Now I'm figuring out right Couchbase schema structure regarding large number of users and API calls.
Meanwhile, I want to keep a cluster with as small number of nodes as possible.
On the Couchbase example leadersboard is implemented using view,
while I prefer to use append operation and manage manual index.
My questions are :
1) Could you give me a recommendation which one to use, view or creating manual index using append operation
regarding the performance and throughput?
2) To keep the manual index updated, when I finish a game and register a new score,
Couchbase have to append this score to all of my friend's leadersboard documents.
mostly new score need be appended to less than 100 documents (=number of user's friend).
However, there might be a extremely hard user that has more than 1000 friends.
For him, when he finish a game, application server need to call append operation to couchbase 1000 times.
I want to know if this scenario is acceptable for correctly using Couchbase.
Firstly, I will say that yes, using the Append operation and manually managing your Index is a possibility within Couchbase and you could do it. But, it's important to remember that because of Couchbase' distributed Indexing and Querying engine, our Views in Couchbase are optimised to be as quick as possible.
Now; the Append operation, as you probably know is a non-JSON operation. It is also a very quick operation to perform. That said, if you are using Binary data, the Append operation cannot be used with JSON, as currently Couchbase Server can only concatenate two bytestreams. This means that it doesn't allow you to replace something within the JSON value.
I am also currently building a Scoring / Leaderboard example app for Couchbase, and the solution here, is to replace the whole document with a single operation utilising Couchbase' CAS value, for concurrency reasons.
However, if you are aware of this, and are using Binary data, the Append operation, as mentioned above is a very quick way of managing data.
Could you give me a little overview of your data structure? Are you thinking of using JSON, or non-JSON docs?
I hope this helps,