How does it compare to lwIP?
That is a difficult question to answer, let me try.
First of, lwip has 3 APIs: raw callback-based, netconn, and socket.
Depending on an API, the architecture of the whole stack is different.
The raw API handles frames in the same task:
driver -> stack -> application, and data is passed via a direct function call.
This is also how Mongoose stack works. This is the fastest architecture in terms of performance. I won't cover LWIP netconn here: it is a "connection abstraction" built on top of raw lwip, very much like Mongoose, which also has a "struct mg_connection" abstraction.
The socket API organises frame handling differently. TCP/IP stack and user app run in different RTOS tasks, and data is passed not via direct function calls, but via a RTOS queue. This makes an implementation slower in comparison to the "raw callback" one, but on the other hand it allows blocking send()/recv() calls. A user app task can block whilst not blocking the driver or stack. Also, a typical lwip firmware runs a separate task to sense PHY status.
Socket layer organises it's own data buffering, to allow app to read data long time after it was received. Data gets buffered by each socket's send/recv buffers, and application has its own buffers. Mongoose built-in stack does not use sockets API, thus it does not have that intermediate buffering - as well as raw LWIP. That means that socket-based implementations are more memory hungry than non-socket. So, socket-based frame handling looks like this:
driver (queue)--> stack + socket buffers task (queue)--> application task I've done a performance benchmark 6-7 months ago, comparing several implementations for fetching a simple "hello world" page, using "siege" benchmarking tool:siege -c 5 -t 5s
http://IP. LWIP config was a default Cube one. All tests were done on a Nucleo-F746ZG, connected to an Ethernet dongle to the same workstation that ran the benchmark - so absolute numbers do not matter, what matters is relative difference.
Zephyr LWIP sockets LWIP raw Mongoose
Requests per second 3 16 286 1080
Firmware size 117k 160k 114k 28k
I don't know why zephyr shows so bad there - maybe something was missing, I just don't believe 3 QPS. LWIP's httpd server was used for the benchmark.
In terms of memory usage, I've shown Mongoose numbers above. LWIP has its own memory manager, and it could be configured to be very efficient with DMA descriptors, so overall I expect that raw LWIP can be configured less RAM hungry as Mongoose. I expect socket-based LWIP to be more memory hungry. Again, that all depends on a specific LWIP config.