Database design for real-time data lookup and refresh

Asked 1 years ago, Updated 1 years ago, 64 views

Hello.

MariaDB is in use.

For example, when developing a program to monitor the real-time changing temperature value of a facility called A,

create table TB_EQUIP (
    equip_name archar (20), -- Facility name
    temperature float -- temperature
)

Create a table with

Is that how it works?

I understand the update is very heavy...

Please advise me how to design efficiently when trying to implement the above process.

Thank you.

mariadb database real-time

2022-09-22 21:26

2 Answers

It is not too much to simply update the temperature. You just need to index the key to update.

In other words, if there are more facilities, the update will load the facilities by the number of facilities per second, which may cause problems, but these days, the hardware is good and applications such as Maria DB perform well, so it doesn't seem unreasonable.

In the case of select, there is as much load as the number of clients per second, and I think this is not too much unless the client (simultaneous connection) is more than 10,000 people (depending on hardware performance...).

Given that the facility is included in your question, I think it will be used only by certain users, not by general service. I don't think you have to worry too much about your subordinates.

Lastly, let me tell you one thing about real-time DB There is a service called firebase acquired by Google. Real-time DB is easy to implement. Real-time DB implementation without worrying about infrastructure (such as load failures). There are examples, so please refer to them.


2022-09-22 21:26

I don't know if the graph has to come out real-time really quickly, but if not, I think it would be good to give it about 10 seconds of free time.

Since the update is heavily loaded, you can also save it in a cache database such as MemCashid and Redis and update it to the main database every 5 or 10 minutes

Or maybe you can keep the temperature value on the server and keep it coming from the client program by plugging in the socket. In this case, put it in the database every few minutes.


2022-09-22 21:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.