Template based data retrieval gets exponentially slower with many fields
Posted: Sat Nov 20, 2021 10:03 am
Hi,
I am building an integration of Meteobridge in to Home Assistant, and I use template.cgi to retrieve the needed fields.
I have all that running fine, but I have run in to the problem that it takes a very long time to get the result back from the Meteobridge Device. I have both a Nano SD and a Pro and it does not make a difference which one I use.
Here is the link to the code that does the actual communication with the Meteobridge Device: https://github.com/briis/pymeteobridge
A few numbers:
There is no network issues and the Nano device runs with 0% Buffers.
The GET request is not complicated, and follows the guide from the Wiki.
I have a few service calls defined that adds a lot more fields, and they are way faster in processing, so am I doing anything wrong or could this be speeded up in any other way?
I am building an integration of Meteobridge in to Home Assistant, and I use template.cgi to retrieve the needed fields.
I have all that running fine, but I have run in to the problem that it takes a very long time to get the result back from the Meteobridge Device. I have both a Nano SD and a Pro and it does not make a difference which one I use.
Here is the link to the code that does the actual communication with the Meteobridge Device: https://github.com/briis/pymeteobridge
A few numbers:
- If I process 62 fields in the template string it takes 7.6 seconds from the GET request until the results are returned. Size of the Request is 2467 Bytes.
- If I process 25 fields in the template string it takes 1.6 seconds from the GET request until the results are returned. Size of the Request is 1034 Bytes.
- If I process 12 fields in the template string it takes 0.4 seconds from the GET request until the results are returned. Size of the Request is 564 Bytes.
There is no network issues and the Nano device runs with 0% Buffers.
The GET request is not complicated, and follows the guide from the Wiki.
I have a few service calls defined that adds a lot more fields, and they are way faster in processing, so am I doing anything wrong or could this be speeded up in any other way?