Error while storing large data in couchbase saying "Too large value" with status code = 3
I am facing a big problem now when trying store large data in couchbase using the following code :
var status = client.ExecuteStore(StoreMode.Add, "Tests", result);
I am using .net 4.0 (C#), and the status code returned with value 1 so how can i fix this issue and store large data ?
Please i need urgent help.
Thanks in advance.
As Jeff mentioned, each individual document or key/value pair cannot exceed 20 MB.
Our suggestion would be to split each document in smaller chunks. You'll probably get the best results with documents of less than 5MB each.
Let's say you're creating an instant messaging platform and a particular conversation became extraordinarily long and took up several megabytes. You could use a combination of an atomic counter and key naming to track the chunks.
So, each of your chunks would have a key name something like this:
Where X is the number of the chunk: e.g. im_text::1, im_text::2, im_text::3 and so on.
You'd use Couchbase's atomic counter data type to keep track of how many chunks you have in each conversation and also to provide you with the number of the next chunk. So, you might have something like:
Each time you want to add a new chunk, you'd send an increment to im_text::counter and it'd return the number to use. To find out how many chunks you have in the conversation, simply GET im_text::counter.
I hope that helps.