There are a few different ways to monitor your Firebase Realtime Database's performance and spot potential problems in your app. Looking at your app's incoming and outgoing bandwidth and load can also give you an idea of what to expect on your bill. Additionally, if something seems off, getting a clear picture of your database's operations can be a helpful troubleshooting tool.
This page discusses Realtime Database performance monitoring. For usage monitoring, see Monitor Database Usage.
Use Realtime Database monitoring tools
You can gather data about your Realtime Database's performance through a few different tools, depending on the level of granularity you need.
Use the Realtime Database profiler tool
The Realtime Database profiler tool provides a realtime overview of read/write operations on your database. The report includes information about the speed and payload size of each operation, in addition to unindexed queries. It doesn't include historical information or any statistics about connection overhead, however, and should not be used to estimate billing costs.
To learn more about using the profiler tool, see Profile your database.
Use the Firebase console
The Usage tab in the Firebase console offers information about simultaneous connections to your database, how much data you're storing, outgoing bandwidth (including protocol and encryption overhead), and your database's load over 1-minute intervals. While the Usage tab gives you a more accurate overview of your database's overall performance, you might not be able to drill down enough to troubleshoot potential performance issues.
Use Cloud Monitoring
With Cloud Monitoring from Google Cloud, you can use the Metrics Explorer to see individual performance metrics, or create different dashboards with charts that display various combinations of performance metrics over time. The Realtime Database integration with Cloud Monitoring offers the deepest level of granularity.
The steps for setting up Cloud Monitoring are described in Monitor Database Usage.
See the following sections for tips on using specific Cloud Monitoring metrics to spot performance issues.
Monitor performance in Cloud Monitoring
If you're experiencing issues with performance, including uptime or latency, you
might want to use Cloud Monitoring to monitor the following metrics.
Note all metric type names are prefixed with
|Network Disabled for Overages
|Storage Disabled for Overages
Combine metrics in charts on your dashboard for helpful insights and overviews. For example, try the following combinations:
- Operations: Use the
io/database_loadmetric to see how much of your total database load is used by each operation type. Make sure to group
io/database_loadby type to troubleshoot different operation types.
- Storage: Use the
storage/total_bytesto monitor your storage utilization in relation to the Realtime Database storage limits. You can also add
storage/disabled_for_overagesto see if your app experienced any down time as a result of exceeded storage limits.
- SSL overhead: Use
network/https_requests_countto monitor how many SSL connection requests your database received, and split out requests that reused an existing SSL session ticket with the
reused_ssl_sessionfilter. You can measure this against the
network/sent_payload_and_protocol_bytes_countto monitor whether or not your app is using SSL session tickets efficiently.
You can also set up alerts through
Cloud Monitoring and receive notifications based on Realtime Database metrics.
For example, you can choose to receive a notification if your
is approaching a certain threshold.
Database Load Types
io/database_load metric also provides a label of which operation type
caused the load. The following are the possible types of operations measured:
admin: Admin operations like setting rules and reading project metadata.
auth: Verifying authentication from service accounts or Firebase Authentication for a single client.
client_management: Handling the addition and removal of concurrent connections this includes running disconnect operations on removal.
get_shallow: Retrieving the data from a REST GET with
get: Handling REST GET operations.
listen: Retrieving the initial data for
onceoperations from connected clients.
on_disconnect: Registering on disconnect operations from clients.
setoperations from clients or REST PUT operations.
transaction: Performing transactions from conditional REST requests or a
transactionoperation from a client.
updateoperations or REST PATCH requests.
Monitor Security Rules in Cloud Monitoring
You can also analyze evaluation of Security Rules. Note all metric type names
are prefixed with
rules/evaluation_count. The number of Realtime Database Rules evaluations performed in response to write or read requests. You can break this metric down by the result of the request (ALLOW, DENY, or ERROR).
Tailor your Cloud Monitoring chart for Rules evaluations as needed, for example by filtering on particular evaluation results, ALLOW, DENY, or ERROR. Setting up and customizing charts is covered in Monitor Database Usage.