Skip to content

Reduce RAM consumption for civetweb HTTP sample #21179

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

Closed
erwango opened this issue Dec 4, 2019 · 3 comments
Closed

Reduce RAM consumption for civetweb HTTP sample #21179

erwango opened this issue Dec 4, 2019 · 3 comments
Labels
area: Networking Clients Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@erwango
Copy link
Member

erwango commented Dec 4, 2019

Is your enhancement proposal related to a problem? Please describe.
Current configuration for Civetweb HTTP sample requires too much RAM (>230K), which prevents it from being run on wide number of targets.

This choice was deliberate at PR introduction (#17019) as described in this comment.

Civetweb is the only HTTP client sample available today for zephyr. This memory consumption makes is unavailable for many targets, so situation is like there were no Zephyr HTTP client for many Zephyr users.

Before net refactoring, I was able to run a micropython powered HTTP server on top of existing networking stack on nucleo_f429zi (192K RAM), so I would expect we could have a zephyr native alternative running on the same platform today.

samples/net/sockets/civetweb configuration shows that main factor for RAM consumption is the following setting:

CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=131072

Below 92000 an illegal exception appears. At 92000 connection closes after a few history clicks.
So getting it down to an acceptable level obviously requires some fine tuning and potentially further optimisation.

Describe the solution you'd like
Rework civetweb sample configuration to fit below an acceptable RAM consumption.

Describe alternatives you've considered

Additional context

@erwango erwango added Enhancement Changes/Updates/Additions to existing features area: Networking Clients priority: medium Medium impact/importance bug labels Dec 4, 2019
@jukkar
Copy link
Member

jukkar commented Dec 4, 2019

Civetweb is the only HTTP client sample available today for zephyr. This memory consumption makes is unavailable for many targets, so situation is like there were no Zephyr HTTP client for many Zephyr users.

This is not correct atm. There is a light weight HTTP client API that is currently used by the Websocket client library. The API can be found in include/net/http_client.h and include/net/websocket.h header files, the code can be found at subsys/net/lib/http and subsys/net/lib/websocket directories.

@erwango
Copy link
Member Author

erwango commented Dec 4, 2019

This is not correct atm. There is a light weight HTTP client API that is currently used by the Websocket client library. The API can be found in include/net/http_client.h and include/net/websocket.h header files, the code can be found at subsys/net/lib/http and subsys/net/lib/websocket directories.

Thanks, I have missed that. I'll have a look, tough the concern for civetweb is still valid (but less important maybe).

@jukkar
Copy link
Member

jukkar commented Dec 5, 2019

Lowering the priority as there is alternative implementation available for HTTP client side. For server side HTTP support there is nothing else available atm.

@jukkar jukkar added priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels Dec 5, 2019
KozhinovAlexander pushed a commit to KozhinovAlexander/zephyr that referenced this issue Sep 29, 2020
adjust configuration so that civetweb uses less memory
fixes zephyrproject-rtos#21179

Signed-off-by: Alexander Kozhinov <[email protected]>
@jukkar jukkar closed this as completed in c28ffbb Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Clients Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants