Number of buckets/channels

Hello!

I’m developing mobile app and want to use Couchbase to sync data between server and application.
I will have up to 50 thousands of different devices, and each device should have it’s separate set of data.

I have doubts how to manage such big amount of devices and spread data between them.
Is it a good idea to make channel for each device based on it’s ID, or better to have different bucket for each device?
What issues (first of all from performance point of view) could I face with such amount of channels/buckets?

Maybe you could suggest better approach to do this?

Thanks.

UPD.
Preliminarily I going to keep 1 user for all devices. So 1 user should be subscribed for 50k channels. Also I’m going to spread my data for two parts - 1st part is common for every device, second part is device-specific. Maybe it is better idea to create separate user for each device, that will be subscribed for two channels - one common for all devices, and another - specific for this device.

https://groups.google.com/forum/#!topic/mobile-couchbase/dIyAu3JAIQM
FYI

thanks, I’v updated my post

Typically a scenario like this would be handled by associating documents with users - because users can switch devices and you would probably want the documents to be available to them regardless of the device they are on.
But assuming your use case requires a single user, the challenge is to generate a unique Identifier for each device. So for instance, if you want documents A and B to be available to all devices and document C available to only device D1, then you will assign A and B to public channel and assign C to a channel with Id D1 .

I have non-trivial use case and it require than one user during single period of time should use only one device.
Thank you for your comment. I assume exactly this implementation.

My main question was about performance issues that I could faced having either 50k+ of channels for single user (and each device will sync only 2-3 channels, but each device will act from one user) or having 50k users (separete user for each device), each of them subscribed for 2-3 channels (some of them are public, other - only for this user).

What is the best way (from performance point of view) to separate data between devices - have different channel of different user for each device?

In case of creating user for each device it could be not so easy to create this users in run-time (due to my requirements and use case).

Thank you!

Hi - So based on discussions with @adamf, assigning 50K channels to a single user will potentially be a non-trivial amount of overhead because during authentication, the user doc has to be loaded and all the channel info unmarshalled . The overhead is incurred on every REST call.
While there are other implications which can be improved by increasing the RAM on the SG and tuning the cache size , the loading of channel info on authentication is non trivial.
So is there any flexibility in the number of users ?

Thank you very much!
I think it is possible to add user for each device, but it will require implementation of registering user from my side through Admin REST API. If it worth it I implement it :-).