-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to calculate buffer size? #153
Comments
@szerwi, thanks for posting this issue. Both batch size and buffer size mean a number of points. To calculate total buffer size, you must consider available RAM (~250k for ESP32), and an average point length. The write buffer is actually limited to 255 batches and each batch can hold a maximum of 255 lines. So, if your batch size is 1, written 6x per minute, the time to fill the buffer is ~42min, so it confirms your observation. Getting back to the calculation, 5_000 points, with a maximum of 255 batches, means ~19 for batch size. Data type |
@vlastahajek, thank you for explanation. Anyway, I think I need to save the reading in SPIFFS instead of RAM. There will be more space & data will be saved even if I restart the ESP. |
I've tried to set batch size to 75 and buffer size to 255, but it still gets full after 42 minutes. Is there any way to make it bigger? |
@szerwi, the problem is in conversion from uint16_t to uint8_t, when calculating |
Thank you for the explanation. Anyway, I have made my own buffer in which I store only 10min readings, skipping 10sec readings. |
I have a problem with understanding buffer size.
I set batch size to 1 and buffer size to 65535, which is the maximum number for uint16_t. I also set flush interval to 65535.
My code is sending data to database every 10 seconds. Each point contains 3 fields.
Once every 10 minutes the point is bigger, it contains 27 fields.
I understand it in this way: if buffer size is set to 2, it can hold 2 points (regardless the fields number).
In this situation I should be able to store 182 hours of data. Unfortunately, the buffer gets full after around 40 minutes.
How to properly calculate buffer size? Is there any way to store a few hours of data in case there is no Internet connection?
The text was updated successfully, but these errors were encountered: