Increase configurability to allow smaller memory consumption #1770
Replies: 1 comment 7 replies
-
I try to provide you with as much details as possible to the constants so that you also have some context:
This corresponds with the app name you set on startup in
Here I would be cautious. This could lead to weird surprises when you use it in combination with
The amount of messages roudi can cache before apps cannot sendout messages anymore.
Used in waitset and listener, if you do not use those constructs you could reduce it even further
When setting up a custom memory config it defines how many mempools you can configure, see: https://github.com/eclipse-iceoryx/iceoryx/blob/master/doc/website/advanced/configuration-guide.md#dynamic-configuration
This is the amount of processes which can register at roudi
We actually dont use this and this could in theory be zero, or one?
Same here
Can be zero or one
The length of the service, instance, event strings in the service description. Reducing those numbers is a real memory safer! If you can deal with one letter names in this triplet I would reduce it to 1. |
Beta Was this translation helpful? Give feedback.
-
The iceoryx management segment is still quite large, even if the configuration options in CMake are set to be very small. It would be good to increase the number of constants that can be easily configured via CMake to make it possible to further decrease the memory consumption of iceoryx.
For example, suppose we set the configurable limits of iceoryx to a bare minimum:
cmake -DIOX_MAX_PUBLISHERS=8 -DIOX_MAX_SUBSCRIBERS=8 -DIOX_MAX_PUBLISHER_HISTORY=1 -DIOX_MAX_SUBSCRIBERS_PER_PUBLISHER=5 -DIOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY=2 -DIOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY=2 -DIOX_MAX_INTERFACE_NUMBER=1 ../iceoryx_meta
Then, the iceoryx_mgmt segment has 20 MBs. Of course, that is fine on large hosted environments. However, in our experiments porting iceoryx to FreeRTOS on smaller embedded platforms, this is still too much.
Note that we are not actually trying to get iceoryx to something very small, like a Cortex-M0 with only tens of kilobytes of memory. We are targeting a reasonable powerful Cortex-M7 with 3 cores (for now, we are just running on one core) and 8 MB of memory. In an ideal world, we would squeeze the code size and the iceoryx segments (management and chunk pool) into 1 MB in total, so that we have the remaining memory for other usage.
In fact, we managed to get the memory consumption under 3 MB, by manually reducing some global constants, which we found to affect the management segment size (and perhaps the code size, too) the most. In particular, we reduced:
MAX_IPC_CHANNEL_NAME_LENGTH
to 20NamedPipe::MAX_MESSAGE_SIZE
to 256NamedPipe::MAX_NUMBER_OF_MESSAGES
to 5MAX_NUMBER_OF_CONDITION_VARIABLES
to 5MAX_NUMBER_OF_MEMPOOLS
to 5MAX_SHM_SEGMENTS
to 1MAX_PROCESS_NUMBER
to 5MAX_NODE_NUMBER
to 5MAX_NODE_PER_PROCESS
to 5NodeName_t
capacity to 20IdString_t
capacity to 20And, actually, even with these greatly reduced constants, we are able to run a very basic demo.
I dont quite understand all the details of what all these constants do, so I am not sure how much limiting it is to reduce them so much. Perhaps some of them dont need to be reduced so much. However, overall, it might be a good idea to increase the configurability of iceoryx and thus enable to control the memory consumption a bit better.
Beta Was this translation helpful? Give feedback.
All reactions