Robin Rieger
Robin Rieger

Reputation: 1194

Couchbase Bucket / View Limits - Design

I have a quick question about the structure of my Couchbase buckets. I am running 2.0 and .net client. We are about to push something live and just want to run through final testing with the 'correct' bucket design but have realized this is not as easy as we thought.

What we have:

Basically we currently have 11 views on 1 bucket. Each view however is written to return data in different ways...

Say a document has the following values (json doc): Value1, Value2, Value3, ... Value50

The views are written so that it emits multiple results, i.e.:

emit ([1, Value1, Value2, Value3], null)

and

emit ([2, Value10, Value20, Value30], null)

Each view is however only on 1 'document type', i.e. all views at the start have a if condition something like if(doc.docType = "Blah")

Then in the .net code when we need the document based on value10, value20 and value30, by having the start key and end key begin with '2' we get what we want.

Question 1: Is this design ok? I have seen many examples like this, however we have like 5-10 different emits in each view, so Couchbase has to index that. Any performance problems with this compared to putting each in their own view?

Secondly, we currently use 1 bucket and got the warning re more than 10 views. So we are going to split the buckets. We were thinking that we could split it into approx 7-8 different buckets based on logical group. We realise there is a 10 bucket limit.

Question 2: I read in one post in one forum that the .net SDK can only connect to 1 bucket at a time.... This seemed wrong. I mean on other questions here on SO, i.e. like here they used multiple buckets. We were going to 'open' the connection in the global.asax for each bucket and then use it through the application. I.e. client1.getview... and then client2.getview... This would mean that 1 page (.aspx), would make 1 call from 1 bucket and another to another bucket to fill the page. I had a quick play around with it and it seemed to work... but just wondering whether this is an acceptable way of using CB. I am confused by the best practice recommendation of putting all documents relating to the 1 logic application in one bucket..... :S I would have made 'almost' 1 bucket per document (so that we can make up to 10 views on it) and then when we hit the 10 bucket limit just started a new cluster (Note: we are in the unique position where we have so much unused hardward, i.e. one server has 64gb unused/unallocated ram, that resources are not a particular problem....performance is!)

I hope my questions make sense. Please let me know if not

Cheers

Robin

Note: .net 4.0, Couchbase 2.0. I have read both manuals and still unclear on the above.

Upvotes: 2

Views: 1394

Answers (1)

Tug Grall
Tug Grall

Reputation: 3510

About your views design.

The global design of you views is ok, meaning have a single view that test the 'type/values' of the doc and emit different index based on this values.

You say that you have 11 views, how are they organized ? how many design documents? views/design document?

I am asking this because all the view within a design document are updated in the same time. Take a look to the "View Design Best Practice" chapter:

http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writing-bestpractice.html

Also big is your dataset/cluster?

Upvotes: 1

Related Questions