Radosław Gajos
Radosław Gajos

Reputation: 33

Firebase realtime databse protocol overhead and SSL encryption overhead

I have an application that uses a native SDK to connect to a database. The application downloads data from the database every 5 minutes 24 hours a day. Checking the downloaded data using the "firebase database: profile" command, it turned out that the average downloaded data is 600 B. Calculating only the downloaded data it turned out that I download about 1.5 GB daily, while in the firebase console daily download it's about 12 GB. Is it possible that the costs associated with "Protocol overhead" and "SSL encryption overhead" are so high that they cost me almost 10 times more than the data downloaded? I am using the "addListenerForSingleValueEvent" method to retrieve data. Is "3.5KB for the initial handshake" added every time it is called? Would it be less costly to use some other methods like "addValueEventListener" and keep the connection going all the time? Is there another way to reduce costs?

Upvotes: 3

Views: 375

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317362

It's not possible to change anything about the protocol and encryption used with communication between client and server. There is no more efficient way to query Realtime Database than addListenerForSingleValueEvent.

To be honest, querying every 5 minutes seems excessive. You should look into something like push notifications to tell a client that there is new data to query, rather than having the client poll the database so often.

Upvotes: 1

Related Questions