Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Firebase streaming REST connections count against the concurrent connection limit?

In a recent question someone pointed out that the Firebase pricing documentation states:

REST API requests don't count towards your connection limits

I understand (and appreciate) this statement for what it seems meant for: GET, PUT, POST and DELETE requests against the REST API are typically used for non-real-time operations on the data, such as downloading the data for back-up or bulk calculations. These are typically infrequent, relatively short-lived operations and in general should dwarf the number of real-time data connections.

But that is different when we look at Firebase's REST streaming API. Unlike the rest of the REST API, the streaming is clearly intended for real-time data connections.

According to the documentation quoted above, these connections should not count against the connection limit. But according to a comment by a Firebase developer on Google Groups:

concurrent [connections] are real-time clients or streamed REST

The part I emphasized seems to suggest that clients using the streaming REST API do count against the connection limit.

To test, I wrote a small C# client that uses the Firebase REST streaming API to monitor a node:

var url = "https://<my>.firebaseio.com/clock/.json";

var client = new WebClient();
client.Headers["Accept"] = "text/event-stream";
using (var stream = client.OpenRead(url)) {
    using (var reader = new StreamReader(stream)) {
        string line = null;
        while (null != (line = reader.ReadLine())) {
            (DateTime.Now.ToShortTimeString() + line).Dump();
        }
    }
}

About 15 minutes after starting this program the concurrent connections in my Firebase dashboard indeed went up by 1. Running a second instance, increased the concurrent connection count in the dashboard again.

So this test seems to confirm what was hinted at on Google Groups: REST streaming clients count as a concurrent connection. Can someone confirm this or spot a flaw in my test?

like image 333
Frank van Puffelen Avatar asked Jan 30 '15 14:01

Frank van Puffelen


People also ask

Can firebase handle 10 million users?

The limit you're referring to is the limit for the number of concurrently connected users to Firebase Realtime Database on the free Spark plan. Once you upgrade to a payment plan, your project will allow 200,000 simultaneously connected users.

How do you filter data in firebase realtime database?

We can filter data in one of three ways: by child key, by key, or by value. A query starts with one of these parameters, and then must be combined with one or more of the following parameters: startAt , endAt , limitToFirst , limitToLast , or equalTo .

How is data stored in firebase?

Firebase Realtime Database is a NoSQL cloud database that is used to store and sync the data. The data from the database can be synced at a time across all the clients such as android, web as well as IOS. The data in the database is stored in the JSON format and it updates in real-time with every connected client.


1 Answers

Your assumptions here are correct. Streaming calls via the REST API do count against your concurrents count as they logically should (i.e. they are holding open a socket connection and creating additional load). Non-streaming calls against the REST API do not count as concurrent connections.

I'll have a look at the pricing page and see if we can make the text a bit clearer.

like image 50
Kato Avatar answered Oct 14 '22 07:10

Kato