S
S
Sergey Dzheygalo2014-11-18 01:44:58
MySQL
Sergey Dzheygalo, 2014-11-18 01:44:58

What to use to optimize mysql database write cycles?

Please tell me options for reducing write cycles when using the mysql database.
The essence of the situation - there is a web system that actively uses the mysql database to record the states of various sensors. For some sensors, a history of readings is stored, for some, the current value from the readings is simply updated. All this happens very actively up to several dozen UPDATEs per second. There is a desire to transfer the system to the Raspberry Pi platform, but such activity will very quickly land the SD card. The option of connecting an external drive is not very interesting, because. the compactness and energy efficiency of the final solution is lost. Actually the question is - what methods can reduce the physical access to the memory card?
If it helps, then I can say that losing some data updates, for example, due to a power failure, is not so critical - it is quite possible to sacrifice updates in 10-15 minutes.
The option that came to my mind is to transfer the entire database into memory at startup and from time to time perform a reverse copy procedure, but there may be a more elegant way, I will be glad if someone shares.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
yarofon, 2014-11-18
@yarofon

If the amount of data is small, you can use the memory tables dev.mysql.com/doc/refman/5.5/en/memory-storage-eng... and synchronize with the rest every 15 minutes. But this requires a change in the program code.

S
Sergey Dzheygalo, 2014-11-18
@Jey

I’ll write one of the solutions for myself - store the entire database in memory (mysql data pack on tmpfs) and from time to time dump to the card (you can pre-compress it in tgz to reduce the size). When loading, respectively, restore from the last saved dump.

A
Alexey Cheremisin, 2014-11-19
@leahch

Use key-value databases like redis and/or mongodb (but it's not really a key-value). For your task, it’s probably the radish itself, and it takes up little space and memory use can be limited, it will be thrown off on a USB flash drive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question