Skip to content

Software

ros2_service_load_balancing

From github.com/Barry-Xu-2018/ros2_service_load_balancing (opens in a new tab)

  • Middleware
  • Library
  • Apache-2.0

A ROS 2 package that adds load balancing to ROS 2 services, so one service name can be served by several server instances.

  • Stale. No commit in 12 months: the newest is from 27 Oct 2025.

Facts

GitHub stars
9read on 29 Nov 2026
Last update
27 Oct 2025Newest commit on main
Maintenance
Staleno commit in 12 months
Difficulty
Intermediate
Hardware it needs, as the project states it
A computer running ROS 2 (Jazzy or rolling are mentioned); no other hardware is stated.

Checked on GitHub on 29 Nov 2026.

Licenses

Code
Apache-2.0 (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit a2b32fb (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

At a glance

What it is
  • A load balancing node sits in front of a service and forwards client requests to the servers behind it.
  • Three selection strategies are offered: round robin, fewest requests, and shortest average response time.
  • The discovery interval for finding service servers is configurable, defaulting to one second.
  • Servers join by remapping their service name to a unique name under load_balancing/<service>/.
  • Clients connect by remapping to the load balancing service name, so they need no changes.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
Apache-2.0. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Stale, last commit on 27 Oct 2025.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit a2b32fb

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @Barry-Xu-2018, at commit a2b32fb, under Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

ros2_service_load_balancing

This package helps ROS2 services implement load balancing functionality.

see overview slide deck (opens in a new tab) for more information.

How to build load balancing service application

In ROS2 environment (such as Jazzy, rolling)

Use rolling as example

$ source /opt/ros/rolling/setup.bash
$ mkdir -p ros2_ws/src && cd ros2_ws/src
$ git clone https://github.com/Barry-Xu-2018/ros2_service_load_balancing.git
$ cd ..
$ colcon build

How to run

Use add_two_ints_server (service server) and add_two_ints_client_async (service client) as an example to introduce how to use load balancing service application

launch service load balancing application

Service load balancing application needs to run first.

$ source /PATH/TO/ros2_ws/install/setup.bash
$ ros2 run service_load_balancing service_load_balancing -s add_two_ints -t example_interfaces/srv/AddTwoInts --strategy less_requests -i 1

The application parameters are introduced as follows

Usage:
    /root/ros2_ws/install/service_load_balancing/lib/service_load_balancing/service_load_balancing [-h|--help] [-s|--service-name SERVICE_NAME] [-t|--service-type SERVICE_TYPE] [--strategy XXX] [-i|--interval TIME]
       --strategy choose one of "round_robin", "less_requests" and "less_response_time"
                  If not set, "round_robin" is used as default.
                  "round_robin": select the service server in order.
                  "less_requests": select the service server with the fewest requests.
                  "less_response_time": select the service server with the shortest average response time.
       --interval Interval to discovery service servers. Unit is second.
                  If not set, default is 1s.

After run, you will get the below output

   Load balancing service name: /load_balancing/add_two_ints
                  Service type: example_interfaces/srv/AddTwoInts
       Load balancing strategy: less_requests
  Interval of server discovery: 1s
------------------------------
Service client remap service name to /load_balancing/add_two_ints
Service server remap service name to /load_balancing/add_two_ints/XXX
------------------------------
launch service server

The service server can refer to the above hint in log output to remap the service name for using the load balancing service.
Assume we start with 2 service servers. Of course, you can add service servers at any time.
In a new terminal,

$ source /opt/ros/rolling/setup.bash
$ ros2 run demo_nodes_cpp add_two_ints_server --ros-args -r add_two_ints:=load_balancing/add_two_ints/s1

In another new terminal,

$ source /opt/ros/rolling/setup.bash
$ ros2 run demo_nodes_cpp add_two_ints_server --ros-args -r add_two_ints:=load_balancing/add_two_ints/s2

Note that you must use different name under load_balancing/add_two_ints/.

launch service client

We can run any number of service clients to connect to the service.

$ source /opt/ros/rolling/setup.bash
$ ros2 run demo_nodes_cpp add_two_ints_client_async --ros-args -r add_two_ints:=load_balancing/add_two_ints

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.