Slow Servers' Gemlog: Ansible vs Rex Bandwidth Usage

Posted: 2026-02-03

Back in January I made some comparisons between Ansible and Rex. Since then, I noticed that Ansible has a rather impressively high amount of bandwidth usage, leading to more testing.

Ansible vs Rex (previous post)

The Test

I wanted a minimal test case to see if my suspicions about bandwidth usage were correct.

Ansible

Version: 12.0.0

Rex

Version: 1.16.1

Execution

I had nothing else running and used bwm-ng to show the sum of traffic from running the scripts. A small amount of bandwidth was consumed over local ICMP/ICMPv6 traffic, but not enough to matter much. bwm-ng was ran only for the duration of each test to try and make it as accurate as possible.

Ansible

Duration: 11 seconds.

Bandwidth:

Rex

Duration: 5 seconds

Thoughts so far

Here, Rex is twice as fast and uses less than 1/7th of the bandwidth. Ansible is looking like quite the hog here.

Let's add an extra statement to each test.

Ansible

It looks like we added 6.8 seconds for one additional statement that is about as small as it could possibly get.

Now we've almost doubled the bandwidth usage going from one statement to two. It looks like it's roughly 300 KB per statement.

Rex

The astute may have observed that Rex adds a newline with content automatically and Ansible does not. I don't think this is necessarily a pro or a con, just a difference to keep in mind when writing either.

About 8 KB and 600 miliseconds for an extra statement. Now Rex is using less than 10% of the bandwidth that Ansible is, and it runs 3x faster.

Conclusion

I didn't make this a perfect test with precise timings, 3 runs, etc, but this gives a good and general idea.

Ansible bandwidth may not sound like much of an issue, but keep in mind that this is an absolutely minimal example. We're not even gathering facts, which Ansible does by default, and many playbooks need. Gathering facts takes more time and seems to use about 300KB more bandwidth.

Many playbooks have tens or hundreds of statements.. And maybe you're running these from a DSL connection, Starlink, coffee shop wifi, etc, and you have about 10Mbit/sec upload to work with. And lets say that you want to manage 3 servers at once. Maybe 10 at once? What about 100? The bandwidth usage alone can be prohibitive.

I like writing Ansible, but this aspect is very disappointing.

Some may be aware that there's a plugin for Ansible called 'Mitogen for Ansible' that is supposed to speed up Ansible considerably. If you're already using Ansible, or you have want to write anything more than a hello world playbook, it's probably worth checking out. I am not sure how it works in practice. I may have used it before, but I can't remember.

Mitogen for Ansible

One more bit about Rex

I mentioned in the last post that I hoped for a way for Rex to work in parallel. I played with the batch setting and didn't have any luck with it. I finally noticed that there is a parallelism configuration, both on the CLI and in the Rexfiles. It appears to work exactly as I hoped.

Return to the gemlog

Return to the index

Proxied content from gemini://slowservers.net/gemlog/2026-02-03-ansible-vs-rex-bandwidth-usage.gmi (external content)

Gemini request details:

Original URL
gemini://slowservers.net/gemlog/2026-02-03-ansible-vs-rex-bandwidth-usage.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.