Skip to content

Collect entities when a new node entity is added/removed#5

Merged
MartinCornelis2 merged 2 commits intonobleo:nobleo/feature/static_executorfrom
mauropasse:mauro/feature/static_executor
Mar 11, 2020
Merged

Collect entities when a new node entity is added/removed#5
MartinCornelis2 merged 2 commits intonobleo:nobleo/feature/static_executorfrom
mauropasse:mauro/feature/static_executor

Conversation

@mauropasse
Copy link
Copy Markdown

@mauropasse mauropasse commented Mar 10, 2020

The static executor has a list which contains executables like timers, subscribers and waitables belonging to nodes registered in the executor.
This list should be rebuilt each time a new entity is added/removed to/from a node, so the static executor checks for guard conditions being triggered in order to re-collect entities.

Some possible guard conditions to be checked by the static executor are:

1. Ctrl+C guard condition
2. Executor interrupt_guard_condition_
3. Node guard_conditions_
4. Waitables guard conditions
5. ...

The previous approach was only checking if NOT (1 & 2), so if a waitable guard condition was triggered it would re-collect all entities, even if no new node entities were added/removed.
This is the case of the intra process manager, which relies on waitables. Every time a subscriber gets a message, all the entities would be re-collected in the executable list. This could happen hundreds of times per second, having a noticeable impact on the CPU performance and in the ROS2 system (high latencies, lost messages).

With the new approach the executable list is rebuilt only when a new node entity is added/removed to/from a node, by checking for triggered guard conditions belonging to nodes registered in the executor.

Below, the benchmark [1] performances for the standard, static and modified static executor on a Rasperry Pi Model A+ (RPi 1), single core @700Mhz
Using:

  • DDS: CycloneDDS
  • ROS2: Master
  • IPC: Enabled
  • Topology: Sierra Nevada (10 nodes - 13 topics)
  • Benchmark duration: 300 seconds
Executor CPU [%] RAM [Mb] Late [%] Too late [%] Lost [%]
SingleThreadedExecutor 72 14.12 0.64 0 0.03
StaticSingleThreadedExecutor 53.71 13.34 21.04 9.96 27.15
StaticSingleThreadedExecutor (this PR) 40.32 13.88 0.05 0 0

The gain in CPU performance is about ~13% compared to the StaticSingleThreadedExecutor, and 32% compared to the SingleThreadedExecutor.

@alsora
@dgoel

[1] https://github.com/irobot-ros/ros2-performance/tree/master/performances/benchmark

Mauro added 2 commits March 3, 2020 18:29
wait_set_.size_of_* is always different than '0'
if we are inside the for loop

Signed-off-by: Mauro <mpasserino@irobot.com>
Now we check ONLY node guard_conditions_

Some possible guard conditions to be triggered HERE are:
1. Ctrl+C guard condition
2. Executor interrupt_guard_condition_
3. Node guard_conditions_
4. Waitables guard conditions
5. ..more

The previous approach was only checking if NOT (1 & 2),
so if a Waitable was triggered, it would re-collect all
entities, even if no new node entity was added. This was the case
of the intra process manager, who relies on waitables.
Every time a subscriber got a message, all the entities
were collected.

Signed-off-by: Mauro <mpasserino@irobot.com>
@MartinCornelis2 MartinCornelis2 merged commit d1cee55 into nobleo:nobleo/feature/static_executor Mar 11, 2020
@mauropasse mauropasse deleted the mauro/feature/static_executor branch March 16, 2020 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants