本文介绍了Firebase使用情况指标中的数据库I / O容量(“Analytics(分析)”标签)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firebase的Analytics(分析)标签中,图表显示了过去24小时内使用的容量。
$ b

我使用Firebase REST API进行了一些查询,结果使用了100%的容量。这到底意味着什么?在这一点上,用户仍然可以访问基地吗? (我在我身上发现了一些错误500)

另外,这个100%容量的原因是什么?当我们尝试从Firebase检索多个数据? (它发生在我停止使用limitToLast参数时发生)

解决方案

由于Firebase数据库接收到读取和写入请求,转。数据库I / O容量图表显示数据库忙于执行读取/写入请求的可用时间百分比。

当这个图表达到100%时,这意味着数据库总是读取或写入。您正在使用可用于您的应用程序的所有数据库I / O容量。发生这种情况时,其他任何操作都会排队等待。

通常情况下,这是由于连接的设备很多,或者某些连接的设备开始收听长列表的数据造成的。一个很常见的原因是当你从你的数据库的根目录读取 ref.once('value'... :加载整个数据库需要的时间增加数据库的大小。



请记住,有一点可以通过使用 limitTo ...( )在一个查询中,Firebase仍然需要考虑列表中的所有数据,并从磁盘读取所有数据。重复执行 limitToLast(1).once('value' ... 在成千上万的项目列表中是一个可靠的方式来使用所有的数据库I / O容量,即使带宽使用可能很小。


In the "Analytics" tab in Firebase, a chart displays the capacity used in the last 24hrs.

I played a bit with queries, using Firebase REST API, and ended up with a 100% capacity used. What does it mean exactly? At this point, is the base still accessible by users? (I got some error 500 on my side)

Also what could be the cause for this 100% capacity used? When we try to retrieve many data from Firebase? (it happened when I stopped using the limitToLast parameter)

解决方案

As the Firebase database receives read and write requests, it executes them in turn. The database I/O capacity chart shows what percentage of available time the database was busy executing read/write requests.

When this chart hits 100%, it means that the database is always reading or writing. You're using all database I/O capacity that is available to your app. When this happens, any other operations are put in a queue and have to wait their turn.

Typically this is caused by writing from many connected devices or when some connected devices start listening to long lists of data. A quite common cause is when you read ref.once('value'... from the root of your database: loading the entire database takes an amount of time that increases with the size of your database.

One thing to keep in mind there is that while you can reduce the bandwidth usage by using limitTo...() on a query, Firebase will still need to consider all data in the list and thus read it all from disk. Doing a repeated limitToLast(1).once('value'... on a list of hundreds of thousands of items is a sure-fire way to use up all your database I/O capacity, even though the bandwidth usage may be quite small.

这篇关于Firebase使用情况指标中的数据库I / O容量(“Analytics(分析)”标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 18:33