Firebase并发读/写请求限制

编程入门 行业动态 更新时间:2024-10-26 12:27:19
本文介绍了Firebase并发读/写请求限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 firebase支持多少个并发的读写请求。它可以支持50k的写入和50k的读取并发请求。在这个负载下读取和写入的平均响应时间是多少?假设数据大小不是很大,比方说只有50k个记录,每个请求将只读取或写入单个记录。 解决方案

在一定的时间间隔内有多少数据可写入磁盘是有物理限制的(在你的问题中你没有提及任何时间间隔)。 Firebase的限制是基于物理限制与逻辑相结合来保持共享服务对每个人的响应。这些数字会定期变化,所以我们不会透露它们。

一旦达到极限,写入就会轮流排队和处理。所以写吞吐量的任何峰值将被缓冲。您可以通过使用完成侦听器来检测您的写入正在被缓冲的时间。对于缓冲写入,您会看到在调用 set()和完成侦听器触发之间的时间增加。

对于这个特定的情况,我建议设置一个小的jsbin并且简单地测试它。写一个50k节点的循环应该很简单:

var ref = firebase.database()。ref(); for(var i = 0; i <50000; i ++){ ref.child(i).set(true).then(function(ref){ // this当写完成}); $ b $ p $ b

你可能想在这里添加一些性能测量逻辑, a href =developer.mozilla/en-US/docs/Web/API/Performance/now =nofollow noreferrer> performance.now() 。

How many concurrent read and write request can firebase support. Can it support 50k write and 50k read concurrent requests. What will be the average response time for both read and write at this load. Assume that the data size is not huge, say only 50k records are there and each request will be reading or writing single record only.

解决方案

There is a physical limit to how much data can be written to a disk in a certain time interval (you fail to mention any time interval in your question). Firebase's limits are based on the physical limits combined with logic to keep the shared service responsive for everyone. These numbers change regularly, so we don't disclose them.

Once you reach the limit, writes will be queued and processed in turn. So any peak in write throughput will be buffered. You can detect when your writes are being buffered by using a completion listener. For buffered writes you'll see an increase in the time between when you call set() and when the completion listener fires.

For this specific case, I'd recommend setting up a small jsbin and simply testing it. A loop that writes 50k nodes should be simple enough:

var ref = firebase.database().ref(); for (var i=0; i < 50000; i++) { ref.child(i).set(true).then(function(ref) { // this is when the write has completed }); }

You'll want to add some performance measurement logic in there, probably using performance.now().

更多推荐

Firebase并发读/写请求限制

本文发布于:2023-11-06 09:43:38,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!