I’m testing a nodejs api running 20 requests per seconds
for each request it reads and writes in 4 buckets. the following image shows stats in web interface
under ops/sec in bucket “torus” I can see 1185 while in other buckets this figures ranges from 20-60.
in bucket “torus” the api just reads using key/value so referencing _id of document directly while in other buckets it uses N1QL+GSI
Now I know key/value is always faster but I didn’t think it was 50 times faster!!!
is it normal, am I reading figures the wrong way?
have I set up GSI the wrong way?
can someone help?
thanks in advance
You need to create right secondary index for query as described at Couchbase server reads per seconds
Please check out Indexing and Optimization articles in http://blog.couchbase.com/wp-content/uploads/2017/03/N1QL-A-Practical-Guide-v2.pdf
In Couchbase when you access the KEY you go directly to the memory of the machine that has the key so its sub-millisecond fast(IMAGE BELOW)
When you use Query/Index …
You go though the Query then Index then Data.
If 100% of your data you want is in the index it will skip the Data service.
In the beginning most people only have Couchbase installed on a single machine or have all the services running on all the machines like below. This is great for small use cases that want HA.
Then as the cluster grows you can expand your cluster and isolate your services. I’ve seen cluster as big as 70+ nodes doing x00,000 of unique queries per second + KEY look ups too.