nickva opened a new pull request, #5883:
URL: https://github.com/apache/couchdb/pull/5883
In #5625 we introduced a BTree cache for dbs, and since view files also use
BTrees, let's use a cache for them as well. This should help with concurrent
view queries.
I test the improvments I used k6 for benchmarking with a 1M doc, q=16 db,
and a view with 10M rows. With a 400 rps request arrival rate saw more than a
50% improvement in average, p90, and p95 latencies:
* Average: 14 -> 7 msec
* Median: 12 -> 7 msec
* P90 21 -> 10 msec
* P95 27 -> 12 msec
* Max 120 -> 77 msec
Since view results could have large kp node values due to custom reduce
functions, add max term limit for cache entries. To avoid adding yet another
config value use a few multiple of BTree chunk size. This should help avoid
config values clashing if users raise the chunk size but forget to raise their
cache term limit (it would render the cache unusuable suddenly).
More detailed test results along with a test at a higher depth of 4 to show
further improvements.
### Depth = 0
```
BENCH_RATE=400 BENCH_DURATION=5m BENCH_VIEW_LIMIT=10 k6 run
./k6_couchdb_constant_arrival_view_query.js
HTTP
http_req_duration..............: avg=14.65ms min=2.08ms med=12.7ms
max=120.08ms p(90)=20.53ms p(95)=26.78ms
{ expected_response:true }...: avg=14.65ms min=2.08ms med=12.7ms
max=120.08ms p(90)=20.53ms p(95)=26.78ms
{ name:view_get }............: avg=14.65ms min=2.93ms med=12.7ms
max=120.08ms p(90)=20.53ms p(95)=26.78ms
http_req_failed................: 0.00% 0 out of 120002
http_reqs......................: 120002 399.891866/s
```
### Depth = 3
```
$ BENCH_RATE=400 BENCH_DURATION=5m BENCH_VIEW_LIMIT=10 k6 run
./k6_couchdb_constant_arrival_view_query.js
HTTP
http_req_duration..............: avg=7.45ms min=2.38ms med=6.9ms
max=77.78ms p(90)=10.21ms p(95)=11.5ms
{ expected_response:true }...: avg=7.45ms min=2.38ms med=6.9ms
max=77.78ms p(90)=10.21ms p(95)=11.5ms
{ name:view_get }............: avg=7.45ms min=2.38ms med=6.9ms
max=77.78ms p(90)=10.21ms p(95)=11.49ms
http_req_failed................: 0.00% 0 out of 120004
http_reqs......................: 120004 399.799018/s
```
### Depth = 4
```
$ BENCH_RATE=400 BENCH_DURATION=5m BENCH_VIEW_LIMIT=10 k6 run
./k6_couchdb_constant_arrival_view_query.js
HTTP
http_req_duration..............: avg=6.21ms min=2.22ms med=5.78ms
max=77ms p(90)=8.4ms p(95)=9.5ms
{ expected_response:true }...: avg=6.21ms min=2.22ms med=5.78ms
max=77ms p(90)=8.4ms p(95)=9.5ms
{ name:view_get }............: avg=6.21ms min=2.22ms med=5.78ms
max=77ms p(90)=8.4ms p(95)=9.5ms
http_req_failed................: 0.00% 0 out of 120003
http_reqs......................: 120003 399.931891/s
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]