My insert speed is 200Hz through local network to a mySQL server. I found out the delay is about 30 seconds.... It seems a lot as the whole things is through Wifi and there are only 4 computers. It shouldn't be the network problem.
When I look at the topic to the MYSQL block and also the OK response from mySQL, there is a 30 seconds delay. Is it reasonable?
Worst case is that I need repack all 200 data and sends them through per second, but I need a time stamp. Does Node-red have ms resolution? Thx
At the input to the MySQL, I look at the topic and see the values change almost right away when I change my input. However, when I look at the OK response from the MYSQL, it has 30 seconds delay. Thx
Put a debug node set to show the complete message, showing what is going into the mysql node and another showing what is coming out. Do a screenshot of the output and paste it here. Or copy/paste the debug window text output.
What is the good practice to check why the node-red crash? I did a simple test and 200Hz write to mySQL should be fine. There is something wrong with my code I think. When I run my code, except the mySQL insert is slow, other things are fine. But then, after about 10 mins, the node-red crash. How to see the memory usage or leak? I don't see any error message during that 10 mins though.
Also, how to auto restart the node-red in Window 10? Thx
If you are sending 200 messages a second and its taking each message 30 seconds to complete I'm not surprised you are running out of memory!
Your error message would also suggest that you are running the mosca MQTT broker?
Are you using node-red-contrib-mqtt-broker?
In which case I'd suggest using a separate MQTT broker instead (eg Mosquito) to remove running an MQTT broker in the single threaded Node-RED app.
You also would appear to be getting error in your SQL statement / data, perhaps its worth "thinning" the data to check to see if you are actually getting tend at a you think you are getting.
Hi, I think those errors is from my serial port when I start the system. Sometimes, a “?” shows when the Arduino starts. It is only at row 1. So, I didn’t pay much attention to it. Also, how to capture the details log of that error? I have checked the database and I don’t see that entry, guess that row error did not insert into the MySQL.Thx
One of those errors visible in the last literal screen photo show a SQL error for wrong integer value for the timestamp column. Instead it tries to insert NaN: not a number. Start with that one, and look for more errors like it, it might speed up a lot.
What is a good way to capture this error? I can not see that entry in mySQL. And in Node Red, if I try to read the output OK packet from SQL, it runs too run and I can not capture it. Can I log the error and all debug message? Thx
The first item is my timestamp in us. See the big gap between insert and OK packet response from SQL? 5376356 us - 34865184 us. That 2 sec grew to -111455220+640499192 us = 530 sec after about 10 minutes SQL_insert_aftersometime|690x388 And for the first row issue, I thank it is because when the node-red starts, it does not sync with arduino, so, only after /n is sent, there may be a NaN.
Without seeing your flow it’s hard to understand .
Why are you using context?
Are you trying to retrieve data stored in context, if so have you read the syntax in the storing data section of the docs page “writing functions”
How have you got your context store configured?
You can set the debug to also write to the console log, so I would configure one to capture the flow of data you also send to the mysql node
I have isolated the flow and did the checking. If the Insert is at 15ms rate, it is alright. But when it goes up to 5ms which is the required 200Hz, the delay accumulates...
I am thinking how to repack the topic to send 200 data at 1Hz...To make an array of 200? Any solution? Thx
Below is the code to make the topic for INSERTION
var AllData;
var newMsg = {};
var Sensor = {
TimeStamp: 0,
Ax: 0, Ay: 0, Az: 0,
Ax1: 0, Ay1: 0, Az1: 0,
ButtonState: 0,
Time: new Date().toString()
};