Ezra Schwepker's photo

Firebase RTDB can experience an extended 100% load event, lasting upwards of 15-30 minutes during intensive use. While this is occurring, its operations per second drops considerably, resulting in a backup of pending tasks, and further exacerbating the issue.

Why is Firebase slowing down while at 100% load instead of continuing to operate at max capacity?

Frank van Puffelen's photo

Firebase's Realtime Database essentially operates as a single threaded process for each database instance. So if you have one long-running operation on the database, that blocks the server from processing any other operations that are going on on that same database.

That's why we recommend performing maintenance in smaller operations, instead of big bulk updates. In fact, that's one of the first things our support team looks for when we are helping developers troubleshoot: are there any periodic processes running that either read the entire database, or update large sections of the database in one go. Splitting such operations up is often the fastest approach to solve the problem.

If you have an operation that needs to inspect the entire database, you can also consider enabling automatic backups of your database, and then using that backup as a read-only copy to perform the analysis. That way you can read the database, without it blocking other operations. This is how you can often optimize maintenance operations too: determine what nodes need to be updated by reading from the backup, then perform a number of (not too big) write operations to update the production database.