In a parallel thread we had some discussions about web servers to be used in conjunction with LVGL and MP.
So I made some benchmarks. I have been testing three servers: my own uwebserver https://github.com/harbaum/LittleBlockly, MicroWebSrv2 https://github.com/jczic/MicroWebSrv2 and TinyWeb https://github.com/belyalov/tinyweb
My own server is single threaded (and can thus only serve one file at a time), MicroWebSrv2 is thread based and TinyWeb uses asyncio. The later can both handle multiple connections in parallel. My test setup on a ESP32 consists of a single small web page with favicon and style sheet and two different 100kB JPG images. These are five files in total, three small ones and two big ones which somewhat resembles the blockly and codemirror setups i intend to use.
With the ESP32 at 160Mhz and nothing else in the background the results are:
MicroWebSrv2: 3.5+14sec TinyWeb: 2+23sec my uwebserver: 1.3+5sec
The first number is the time after which the first index.html is successfully transferred and the second number is the additional time until all five files are completely transferred. One can e.g. see that Tinyweb reacts faster and has thus an advantage over MicroWebSrv2 with small files. But MicroWebSrv2 is faster with the transfer itself and thus needs less time for the overall transfer.
But this also shows that simplicity has a significant advantage here and my trivial solution beats both significantly. I have a semi-finished version that avoids using readline which gives another advantage:
uwebserver new: 0.8+3.5sec
I also tested all at 240Mhz:
MicroWebSrv2: 3.5+12.5sec TinyWeb: 2+20sec uwebserver old: 1+4.5sec uwebserver new: 0.6+3.5sec
So the CPU has an impact.
Some days ago I already tried MicroWebSrv2 in conjunction with the LVGL advanced_demo to see how much impact that has:
MicroWebSrv2 @160Mhz with chart page not visible: 4+19 sec MicroWebSrv2 @240Mhz with chart page not visible: 4+18 sec MicroWebSrv2 @160Mhz with chart page visible: 37+260 sec, image transfers time out MicroWebSrv2 @240Mhz with chart page visible: 16+100 sec
So the high CPU load of the chart graphic in the demo has a huge impact on the overall performance. And in that scenario the extra 80 MHz are helpful. Still web and advanced graphics at the same time is a problem.
There are two things I plan to do:
a) try to optimize my own server somewhat. It’s sure less stable than the other two and will need some work here and there
b) try to use the http server of the espidf. This is why i asked about the generator script
I really think that a webserver is a useful addon for MP on the ESP32 and I still hope to be able to implement a useful remote display feature. I hope that WebSockets like https://github.com/danni/uwebsockets may help getting latency down compared to the current stream of http get requests. And some simple rle encoding of the image data may help speeding up the data transfer itself. But since espidf itself also offers websockets I would also like to try this with espidf.
The espidf web server would imho very much be in the spirit of MP and LVGL where the framework itself is written in C to be as fast as possible and the user programs are written in MP (and HTML) to ease application development.