We run a Firebase application using onCall heavily.
(我们大量使用onCall运行Firebase应用程序。)
The problem, however, is that the functions answer unreasonably slow.(但是,问题在于这些函数的响应速度过慢。)
Simple functions take 4 seconds to answer even after repeat invocations.(即使重复调用,简单的功能也需要4秒钟来回答。)
Som things we already take into account:
(索姆我们已经考虑到的事情:)
- Coldstart: We are aware that Firebase cloud functions can be slow when they have not been run for a while.
(Coldstart:我们知道,Firebase云功能一段时间未运行可能会变慢。)
We still have the problem after repeat invocations.(重复调用后,我们仍然遇到问题。)
- Large result set: The responses are slow even when Firestore result sets are empty.
(结果集大:即使Firestore结果集为空,响应也很慢。)
- CORS OPTIONS preflight also take unreasonably long to response (often 4-8 seconds)
(CORS OPS选项飞行前也需要花费不合理的时间(通常4-8秒))
- We are on a Blaze plan.
(我们正在大火计划中。)
- The same call with the same result size yield very different
(具有相同结果大小的同一调用产生的差异非常大)
In the following picture, none of the calls are other than simple Object retrievals.
(在下图中,所有调用都不是简单的对象检索。)
None of the documents in the result sets trigger further checks.(结果集中的任何文档都不会触发进一步检查。)
Still we have more than 8 seconds for retrieving 66KB woth of data.(仍然需要8秒钟以上的时间来检索66KB的全部数据。)
Following image are merely for preflight requests.
(以下图像仅用于飞行前的要求。)
We do not expect those to even hit our code.(我们不希望那些代码甚至会破坏我们的代码。)
Is that wrongly assumed?(这是错误的假设吗?)
Lastly, it should be mentioned that we are based in the EU and that the servers are located in the US.
(最后,应该提到的是,我们位于欧盟,而服务器位于美国。)
But we don't think that this explains 4 second response times.(但是我们认为这不能解释4秒的响应时间。)
ask by Mads Buch translate from so