Does get_mutli and get_multi_async fetch results in 1 RPC?
Muneeb147 opened this issue · 0 comments
As per documentation of google-appengine ndb, the get_multi is 1 RPC and fetches results in one request (screenshot/link given):
However, google-cloud-ndb is missing these RPC details for get_multi (in documentation) and it is assumed that it should be in 1 RPC (as per following statement in doc):
Does "at once" mean 1 RPC? If yes then it's not working and each key get call is a separate RPC (details given below)
Secondly a concern about parallel yield of ndb.tasklets. In google-appengine ndb, it is clearly mentioned that parallel yielding of multiple tasklets at once will be one request (one RPC) which is now not the case with google-cloud-ndb (python 3+). Is this RPC issue related to get_multi concern? Something already noted or do we need any clarification here?
Please feel free to ask if more details are required from our side.
Environment details
pip show google-cloud-ndb
Name: google-cloud-ndb
Version: 1.7.3
Summary: NDB library for Google Cloud Datastore
Home-page: https://github.com/googleapis/python-ndb
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /Users/Muneeb/Documents/educative/backendvenv/lib/python3.9/site-packages
Requires: google-cloud-datastore, pymemcache, redis
Required-by:
pip show google-cloud-datastore
Name: google-cloud-datastore
Version: 1.15.3
Summary: Google Cloud Datastore API client library
Home-page: https://github.com/googleapis/python-datastore
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /Users/Muneeb/Documents/educative/backendvenv/lib/python3.9/site-packages
Requires: google-api-core, google-cloud-core
Required-by: google-cloud-ndb
opentelemetry-api==1.1.0
opentelemetry-exporter-gcp-trace==1.0.0
opentelemetry-instrumentation-redis==0.20b0
opentelemetry-instrumentation-requests==0.20b0
opentelemetry-instrumentation-wsgi==0.20b0
opentelemetry-propagator-gcp==1.0.0
opentelemetry-sdk==1.1.0
python --version
Python 3.9.6
// Package used for Cloud Tracing:
opentelemetry-api==1.1.0
opentelemetry-exporter-gcp-trace==1.0.0
opentelemetry-instrumentation-redis==0.20b0
opentelemetry-instrumentation-requests==0.20b0
opentelemetry-instrumentation-wsgi==0.20b0
opentelemetry-propagator-gcp==1.0.0
opentelemetry-sdk==1.1.0
Steps to reproduce
- Create ndb Model Keys list and call get_multi on it.
- Monitor Cloud Trace and the RPC calls will be equal to the keys list (which should be 1 RPC only).
Cloud Trace Example of Our Case:
Code example
users = ndb.get_multi([ndb.Key(User, user_id) for user_id in user_ids])