MySQL ++, real-time data storage

Firstly, I am an engineer, not a computer scientist, so please be careful. I currently have a C ++ program that uses MySQL ++. The program also includes the NI Visa runtime. One of the interrupt handlers receives data (1 byte) from a USB device about 200 times per second. I would like to save this data with a timestamp for each sample on a remote server. Is it possible? Can anyone recommend a good approach? Regards, Michael

+3
source share
4 answers

I think that executing 200 transactions per second on a remote server requires a lot, especially considering that these transactions will occur in the context of an interrupt handler that must do its job and quickly do its job. I think it would be better to separate the interrupt handler from access to the database - perhaps the interrupt handler stores the incoming data and timestamp in some form of data structure in memory (an array, a circular linked list or something else with the corresponding synchronization) and there is A separate thread that waits until the data is available in the data structure, and then transfers it to the database. I would like this interrupt handler to be as dry and deterministic as possible, and I'm concerned that accessing the database over the network to the remote server will be too slow - or,even worse, it will be ok in most cases, but sometimes we go to h * ll for no apparent reason.

, , / , , , . . , ?

+4

, 1 , , , .

INSERT INTO records(timestamp, value)
  VALUES(1, 2), (3, 4), (5, 6), [...], (399, 400);

, 200 ( - ), SQL . sprintf . , .

, SQL - , , API (, ), . , , , SQL. , .

+1

, : 1. 2. . USB ​​ . , .

, , . . , . , .

- , LOADFILE MySQL . , , MySQL ++ .

0

multithreading does not guarantee faster than an apartment, even if you correctly cached it on the server side, if there was no strange priority of processor priority. What about using shaders and skipping over a reference value in windows.h be a timestamp

0
source

Source: https://habr.com/ru/post/1730039/


All Articles