Firebase has been around for about 4 years since it first founded in 2011. And its popularity has been booming and also been acquired by Google few years later!
Do you know what Firebase could do?
Actually, its killer features could save you half of time in building scalable APIs for your web app or mobile application that does not required much data loading or complex transactions that required at backend.
Cool isn't it? We have been using for web app and its features amaze us in terms of speed, performance and development time. We used AngularFire with other client side component to build a sophisticated web app prototyping system.
No wonder it saves us alot but for us, some complex require loads of data and transaction back and forth, it got us stuck at some times the data is increasely big in Firebase database.
Now by looking at the Network inspection tool of Google Chrome above, we can say all read or write transactions are performing only in a single thread/Frames here. We could not update record B until we load or do something with record A completed. We got some serious performance problem here and drag our web app performance greatly to a point we would get down to table and discuss the issues and how to make this out.
With some times of stimulating the solutions we come up with some idea such as:
- Limit the records load from Firebase for listing view for pagination
- Apply multiple queries to reduce data at first point of loading
- Try preloading before the system allow users to use
However, none of those solves us well. First one, we could apply limit to and start from but due to its restrictions to one field query, we could not apply additional data queries condition at all. In addition to the first one, the second ones look more impossible as well! For the last one, third one, that will just keep our users waiting long times before system load but they are not as patient as us!
After failing all those options, we find a way to do this by implement additional sync-to-read server using MongoDb and NodeJS.
Even though, I would like to say more about the solution in one article, the time is not allowance and I have to split into next one and the final one. I hope you guys understand and I will continue my part two in the next few days. Stay tuned and cool!