Skip to content

Websockets asyncio#152

Open
gonzalocasas wants to merge 12 commits into
mainfrom
websockets-asyncio
Open

Websockets asyncio#152
gonzalocasas wants to merge 12 commits into
mainfrom
websockets-asyncio

Conversation

@gonzalocasas
Copy link
Copy Markdown
Contributor

@gonzalocasas gonzalocasas commented May 30, 2026

Trying out an alternative, opt-in transport/event loop based on websockets + asyncio.

The new transport can be be manually selected via a transport kwargs on Ros, or set via set_default_transport, or with an environment variable.

I added some benchmarks as well. The benchmarks run on CI, the results are uploaded to the summary page of the CI task, here are the results of one of the latest runs. The conclusion is that the new transport has marginally higher topic throughput.

roslibpy transport benchmark

These numbers are sampled on shared CI infrastructure. Topic p95 and max
latencies can be noisy because of runner scheduling, Docker networking,
and rosbridge timing. Prefer medians and throughput for quick comparisons;
interpret tail latency across several runs.

Transport Metric Mean Median P95 Max Value
twisted initial connect 3.897 ms 3.897 ms 3.897 ms 3.897 ms
twisted get_time service 3.138 ms 3.129 ms 3.238 ms 3.827 ms
twisted topic round trip 9.671 ms 0.687 ms 59.643 ms 69.033 ms
twisted topic throughput 1373.0 msg/s
asyncio initial connect 3.624 ms 3.624 ms 3.624 ms 3.624 ms
asyncio get_time service 3.022 ms 3.014 ms 3.119 ms 3.268 ms
asyncio topic round trip 0.587 ms 0.584 ms 0.636 ms 0.845 ms
asyncio topic throughput 1454.0 msg/s
asyncio-uvloop initial connect 3.914 ms 3.914 ms 3.914 ms 3.914 ms
asyncio-uvloop get_time service 2.993 ms 2.966 ms 3.111 ms 5.071 ms
asyncio-uvloop topic round trip 7.139 ms 0.566 ms 45.190 ms 55.156 ms
asyncio-uvloop topic throughput 1480.2 msg/s
asyncio-no-compression initial connect 3.567 ms 3.567 ms 3.567 ms 3.567 ms
asyncio-no-compression get_time service 3.016 ms 3.008 ms 3.091 ms 3.808 ms
asyncio-no-compression topic round trip 0.724 ms 0.576 ms 0.748 ms 8.485 ms
asyncio-no-compression topic throughput 1460.7 msg/s
asyncio-uvloop-no-compression initial connect 3.958 ms 3.958 ms 3.958 ms 3.958 ms
asyncio-uvloop-no-compression get_time service 2.940 ms 2.932 ms 3.006 ms 3.684 ms
asyncio-uvloop-no-compression topic round trip 0.630 ms 0.549 ms 0.854 ms 3.777 ms
asyncio-uvloop-no-compression topic throughput 1478.4 msg/s

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.rst file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke check).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@gonzalocasas gonzalocasas marked this pull request as ready for review May 30, 2026 15:00
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.

1 participant