Adventures in Rust and Load Balancers

Convey

sudo RUST_LOG=DEBUG ./target/release/convey --config=config.toml
sudo iptables -t raw -A PREROUTING -p tcp --dport <LOAD_BALANCER_PORT> -j DROPsudo iptables -t raw -A PREROUTING -p tcp --sport <BACKEND_SERVER_PORT> --dport 33768:61000 -j DROP
sudo RUST_LOG=DEBUG ./target/release/convey --passthrough --config=config.toml
sudo iptables -t raw -A PREROUTING -p tcp --dport <LOAD_BALANCER_PORT> -j DROP
sudo tc qdisc add dev enp0s8 root handle 10: htb

sudo tc filter add dev enp0s8 parent 10: protocol ip prio 1 u32 match ip src <LOCAL_SERVER_IP> match ip sport <LISTEN_PORT> 0xffff match ip dst <LOAD_BALANCER_IP> action ok

sudo tc filter add dev enp0s8 parent 10: protocol ip prio 10 u32 match ip src <LOCAL_SERVER_IP> match ip sport <LISTEN_PORT> 0xffff action nat egress 192.168.1.117 <LOAD_BALANCER_IP>
sudo RUST_LOG=DEBUG ./target/release/convey --dsr --config=config.toml

Benchmarks

wrk -t6 -c200 -d120s --latency http://192.168.1.197
+---------+----------+------------+-----------+-----------+
| SW | Avg Lat. | Avg Req/s | Total Req | Data Read |
+---------+----------+------------+-----------+-----------+
| Nginx | 9.95ms | 3.42k | 2450490 | 1.96GB |
| HAProxy | 9.43ms | 3.55k | 2544029 | 2.04GB |
+---------+----------+------------+-----------+-----------+
+--------------+----------+------------+-----------+-----------+
| SW | Avg Lat. | Avg Req/s | Total Req | Data Read |
+--------------+----------+------------+-----------+-----------+
| Nginx | 9.95ms | 3.42k | 2450490 | 1.96GB |
| Haproxy | 9.43ms | 3.55k | 2544029 | 2.04GB |
| Convey Proxy | 7.46ms | 5.81k | 4156170 | 3.32GB |
+--------------+----------+------------+-----------+-----------+
+--------------+----------+------------+-----------+-----------+
| SW | Avg Lat. | Avg Req/s | Total Req | Data Read |
+--------------+----------+------------+-----------+-----------+
| Nginx | 9.95ms | 3.42k | 2450490 | 1.96GB |
| HAProxy | 9.43ms | 3.55k | 2544029 | 2.04GB |
| Convey Proxy | 7.46ms | 5.81k | 4156170 | 3.32GB |
| Convey DSR | 16.30ms | 4.98k | 3565295 | 2.85GB |
+--------------+----------+------------+-----------+-----------+

Takeaways

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store