Description
Currently, all calls to CouchbaseCollection.GetAsync are being sent to the server as 0xd0 SubDoc Multi Lookup operations, regardless of the values in the projection list.
Following the RFC, the request is altered based on the number of projections requested. If no projections are requested or if more than 16 projections are requested, then the SDK requests the entire document body. However, it still does so using a 0xd0 SubDoc Multi Lookup operation.
I believe that in both of these cases (0 projections or >16 projections) a 0x00 Get operation should be issued instead. In particular, a 0xd0 request bypasses any Snappy compression. The document is decompressed on the data node, placing all decompression CPU load on the data node and increasing the required network traffic.
Note that there may be other cases where 0xd0 is required. For example, the Java SDK also sends a subdoc operation if the options have an expiry. https://github.com/couchbase/couchbase-jvm-clients/blob/cf4c15033ed50d1d22e518e8b895fe4a29deb08f/java-client/src/main/java/com/couchbase/client/java/AsyncCollection.java#L267
Note: as of today, the compression difference isn't really a factor since the .NET SDK doesn't support compression. However, I'm working towards a system that will allow cross-platform Snappy support.
Attachments
For Gerrit Dashboard: NCBC-2679 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
138879,7 | NCBC-2679: Use 0x00 for full document gets | master | couchbase-net-client | Status: MERGED | +2 | +1 |