Database I/O Capacity in Firebase usage metrics (“Analytics” tab)

守給你的承諾、 提交于 2019-12-11 09:45:39

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/34482615/database-i-o-capacity-in-firebase-usage-metrics-analytics-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!