Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ids are 566, fetched documents are 566
- --------------------------------Approach1-----------------------------------------
- Normal Bucket:176ms
- Ephemeral Bucket:158ms
- Code:
- StopWatch stopWatch = new StopWatch();
- stopWatch.start("query");
- List<JsonDocument> foundDocs = rx.Observable
- .from(ids)
- .flatMap(id -> bucket.async().get(id))
- .toList()
- .toBlocking()
- .single();
- stopWatch.stop();
- ---------------------------------Approach2-----------------------------------------
- Normal Bucket: 382ms
- Ephemeral Bucket: 386ms
- Code:
- StopWatch stopWatch = new StopWatch();
- stopWatch.start("query");
- for (String id : ids) {
- JsonDocument jsonDocument = bucket.get(id);
- }
- stopWatch.stop();
- ----------------------------------Approach3------------------------------------------
- Normal Bucket: 434ms
- Ephemeral Bucket: 449ms
- Code:
- StopWatch stopWatch = new StopWatch();
- stopWatch.start("query");
- Statement stmt = Select.select("*").fromCurrentBucket().useKeys(JsonArray.from(ids));
- N1qlQueryResult query = bucket.query(stmt);
- stopWatch.stop();
- ---------------------------------Approach4-------------------------------------------
- Btw if I use spring repository, much more time is taken (3011ms).. I imagine its all the overhead of the json to entity mapping
- Code:
- StopWatch stopWatch = new StopWatch();
- stopWatch.start("query");
- for (String id : ids) {
- TestEntity testEntity = testRepo.findById(id).orElse(null);
- }
- stopWatch.stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement