Is this typical firebase write frequency

Viewed 115

We are attempting to use firebase to convey bursts of real-time data (using firebase C++ API). These bursts can be 60 node-creates per second for several seconds. If we perform the writes without waiting for completion, eventually things slow to a crawl where it takes several seconds for a write to appear in DB. If we only perform a write only after a previous write has completed, we get much lower write-rate than desired. Testing using RunTransaction and UpdateChildren produce similar results. Each node has 5 children with short string values. Do these numbers look typical, or are we doing something wrong?

Existing nodes in BD nodes created/second
-------------------- --------------------
          0               13.0
         10                2.4
         25                0.9
         50                0.5
        100                0.2

Generic version of our code:

firebase::database::DatabaseReference new_node = dbroot_.Child(new_node_key);
firebase::Future<firebase::database::DataSnapshot> future;
future = new_node.RunTransaction([](firebase::database::MutableData* mutableData) {
  std::map<std::string, firebase::Variant> children = {
    {"field1", firebase::Variant("value1")},
    {"field2", firebase::Variant("value2")},
    {"field3", firebase::Variant("value3")},
    {"field4", firebase::Variant("value4")},
    {"field5", firebase::Variant("value5")}
  };
  mutableData->set_value(children);
  return firebase::database::kTransactionResultSuccess;
});
future.OnCompletion(...
  // call completion handler
);
0 Answers
Related