简体   繁体   English

谷歌云数据存储延迟

[英]Google Cloud Datastore latency

I have an API deployed on Cloud Run where each request results in a read + write to Cloud Datastore.我在 Cloud Run 上部署了一个 API,其中每个请求都会导致对 Cloud Datastore 的读取 + 写入。 A non-trivial amount of the requests are first timers (read from Datastore will return null), so adding caching in front of it may not be too helpful.大量请求是第一个计时器(从 Datastore 读取将返回 null),因此在其前面添加缓存可能没有太大帮助。

Over the past month, the average wall time around calling Datastore and having the data ( data = client.get(key, eventual=True) ) is 48ms.在过去的一个月中,调用 Datastore 并获取数据 ( data = client.get(key, eventual=True) ) 的平均挂墙时间为 48 毫秒。 The payloads are small (a list of dicts, with 10 elements on average, and each dict has two floats).有效载荷很小(一个字典列表,平均有 10 个元素,每个字典有两个浮点数)。

I'm not sure if I should say that latency is high, but my API has a budget of 100ms to do all that it needs to do and return.我不确定我是否应该说延迟很高,但我的 API 有 100 毫秒的预算来完成它需要做的所有事情并返回。 If just the data fetching takes ~50% of that time, I'm looking for ways to optimize things.如果只是数据获取需要大约 50% 的时间,我正在寻找优化事物的方法。

Questions:问题:

  1. In general, how does 50ms sound for fairly small payloads, fetched by key, from within GCP?一般来说,对于从 GCP 中按键获取的相当小的有效载荷来说,50 毫秒听起来如何?
  2. What should I expect (in terms of latency) from Memorystore within GCP?我对 GCP 中的 Memorystore 有什么期望(就延迟而言)?

Assuming you are using Cloud Run and Datastore on the same location, I would say that 50ms is around the expected latency you have for reading on datastore, the size of the payload does not matter as much for reads (10 - 1000 document reads do not make a big difference on time of processing/propagating).假设您在同一位置使用 Cloud Run 和 Datastore,我会说 50 毫秒大约是您在数据存储上读取的预期延迟,有效负载的大小对于读取并不重要(10 - 1000 个文档读取不在处理/传播时间上有很大的不同)。

Since you have such a small window for you API to operate, this could indeed be a problem if some unnexpected delays occur.由于您有这么小的 window 供您操作 API ,如果发生一些意外延迟,这确实是一个问题。

I have never used Memorystore so I can't say what you could expect of actual latency but it might be a better option given that every ms to your app counts.我从未使用过 Memorystore,因此我无法说出您对实际延迟的期望,但考虑到您的应用程序的每一毫秒都很重要,这可能是一个更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM