We try to get data from couchbase by using Rxjava as the tutorial recommended, below is the code:
public List batchGet(final Collection ids) {
return Observable
.from(ids)
.flatMap(new Func1<String, Observable>() {
@Override
public Observable call(String id) {
return bucket.async().get(id);
}
})
.toList()
.toBlocking()
.single();
}
But we found if the Collection ids is big enough(50k), it will cause a out of memory Exception, then we change the code and invoke this method serval times to avoid the exception.
If there an recommended observable collection size? Our test results shows if collection size is 10K will costs 1.5 seconds each time and 20K size costs about 2.2 seconds.
Thank you very much.