Well, your benchmark is measuring GET performance of a small number (566) of keys. Both Couchbase and Ephemeral buckets will cache documents in memory - for Couchbase buckets it can eject those items (and re-read from disk) if there’s insufficient memory. So it would be expected that measuring GET times will be similar (if not identical) durations.
Depends on what workload you are trying to model / what your requirements are
Approach 1 - where you use async(), allowing the SDK to issue multiple requests in parallel - will likely to be the fastest, but can be more complex, especially when dealing with errors.
Approach 2 - a simple for() loop - is the simplest and might be fine for non-performance sensitive use-cases, or where you want to make sure you have 1 document (and maybe perform some updates on it) before accessing the next document
Approach 3 - N1QL query - will always be slower than a simple K/V operation, but it does allow greater flexibility if you want to apply a WHERE clause to what you fetch. However if you already know the key(s) you need, direct KV is virtually always preferred.
No idea tbh, I don’t know much about Spring performance.
Note that Ephemeral buckets aren’t really about being faster than Couchbase buckets - both will cache cache in memory for fast reads, and for writes Couchbase buckets will by default queue the disk write so the SET() will will return often before the item has hit disk (see Observe()
if you want to change this behaviour).
Ephemeral’s purpose is one of efficiency and simplicity - you don’t need to provision or manage disk; and because there’s no cost of writing to disk you can often perform the same amount of work on a smaller machine / cluster.
Note if you really push a cluster - such that nodes are actually CPU-bound then you should see Ephemeral actually have lower latency / higher throughput - but until you reach that point you’ll likely see them perform the same, except Couchbase buckets would be expected to have higher CPU usage.
For example on our own testing environment where we run with:
10 CPU cores, doing 50% reads 50% writes to 200 million documents of size 512Bytes
We see Ephemeral do 1,340,000 op/s, and Couchbase do 998,000 op/s -34% higher throughput for Ephemeral compared to Couchbase bucket.