Reduce costs in the firebase component

And I’m trying to save as much data as possible, I’m saving downloaded data to the device so next time you don’t have to waste any more data (according to the data I collected this way, I saved 6,975 requests from the database), but I still don’t see any significant improvement

1 Like

In firebase db, i just saw my data downloads is 2gb in last 30 days and in last 7 days it is 700mb.

Currently, I have 1.8k users and day by day this number is increasing with daily 50+ new users.

By this speed, i will reach free limits of firebase db free plan.

I have to think about a good database with least cost or at no cost.

Because i am not started earning money from my app yet.

I have never used mysql before.

Can we store and call data same as firebase database means i want to call lists and values under that list.

1 Like

Yes everything is possible but syntax will change that’s all.

1 Like

What it means?

Well regarding the data structure it will change because in mysql db you won’t have project bucket and key and value thing but consider it like this,

  1. Project Bucket in Firebase is called Table in MySQL
  2. Key is called the record id
  3. Value is the corresponding row of data for that row id

Like this
Table Student
Record_id student_name student_class student_section student_roll_number
1 ABCD 5th A 5
2 CDEF 5th A 6

1 Like
1 Like

Have you tried batching calls to the database?
For example, instead of querying several child tags, you could query the parent and get all data at once

1 Like

I am using firebase too and have been reading about the potential horrors in cost. I want to try converting to mysql but how do I make it real time like firebase? Need it for a group chatapp.

1 Like

Real time? The bank will be on the web server. That simple . The second most used bank in the world and free. For desktop, web and app applications.
You will need a host where your database will be located. I pay annually.

by real time, I mean like using the “firebase when data changed” block that will instantly update all values on devices, when there is a change in value in firebase realtime db. How can we implement that in mysql?

I know what real time is. Yes, of course, each Update, Delete, Create update will be updated on the app, website and desktop within your company. How to do this ? For every SQL command that changes the table, everyone who accesses that table will be updated instantly.

Yes, so how do I that? By downloading data from mysql every few seconds using kodular blocks, then check whether anything has changed? Or is there a better more elegant, less resource intensive method?

You do not download data from mysql. You work with POST methods. If you want a data search, do a Select. If you want to include data in the bank, use Insert Into. If you want to update something, use Update.

If another device updates the data in mysql (say, adding a new chat message), how does my device know that the data in mysql has been updated with the new chat message? How do I “listen” to a data change?
I am sorry if I sound stupid, I really know nothing about mysql.

This involves designing the bank to link messages to a room or chat. And it involves your app’s algorithm.

I can’t guarantee that it works, but I can suggest this:

You could rethink and recreate your application back-end using Laravel, expose an API, use Laravel Broadcasting, and the WebSocket Client extension


References:

https://laravel.com/docs/7.x/broadcasting

In many modern web applications, WebSockets are used to implement realtime, live-updating user interfaces. When some data is updated on the server, a message is typically sent over a WebSocket connection to be handled by the client. This provides a more robust, efficient alternative to continually polling your application for changes.


It’s just an idea

1 Like

I think using the web component you will post text to the server hosted script which will get the latest data from your db and you can filter the records based on what data should be pulled.

Like in case of chat, if A person is talking with B&C&D then you just pull data which involves only A and B or C or D as applicable.

You need to put that in a timer block to keep checking repeatedly.

2 Likes

Exactly. It involves the design of the bank and the logic of the app. The bank update is immediate. In the app, it will make a logic to be shown that last message from that chat room where the A & B & C & D people are …

1 Like

https://medium.baqend.com/real-time-databases-explained-why-meteor-rethinkdb-parse-and-firebase-dont-scale-822ff87d2f87

I got answer this regarding realtime database.

1 Like

Wow. Sounds good. But thing is, I don’t mind complicated but if I can’t find tutorials on how to use websockets and node.js and have them work with kodular or app inventor, I really am clueless on how I can do them.

There are tutorials out there on how I can connect mysql with kodular, and how to make them communicate, but I have not successfully found tutorials on how to connect mysql to node.js and websocket. To be honest, I am just regurgitating what I read without understanding much what websocket and node.js do to make mysql realtime and whether we need both or just 1 of them.

If you know any good tutorials on how to make them all work together with the app inventor franchise, I will get down to it immediately.