P2P Media Loader is our open-source JavaScript library for P2P video: viewers of the same HLS or MPEG-DASH stream share video segments with each other over WebRTC, so part of the video can come from other viewers instead of the CDN. To find each other, every viewer keeps a WebSocket connection to a WebTorrent tracker, which introduces viewers of the same stream to each other. The tracker in this article works for any WebTorrent-compatible client, including the WebTorrent client itself. In P2P Video Delivery for up to 100k Viewers for Free we showed how to run a tracker for up to 100,000 simultaneous peers on the Oracle Cloud Always Free Tier, which then included an Arm-based Ampere A1 instance with 4 cores and 24 GB of memory.
What the tracker does: signaling only. It introduces peers to each other, and then they connect directly over WebRTC. How much video then travels between peers depends on other things, mostly on how many peers can reach each other over WebRTC and on the stream itself. The tracker’s job is to do the signaling reliably, for every viewer, all the time.
Oracle has since halved that allowance: the Always Free Ampere A1 resources are now 2 cores and 12 GB. We set ourselves a goal: 100,000 peers on the reduced free tier, for €0 a month. It is part of a bigger aim behind P2P Media Loader: to bring the cost of video delivery close to zero, so that streaming to a large audience is affordable for anyone.
This article describes how we got there in a few days: a new multi-core tracker written in Rust with AI-assisted development, an Oracle network setting that is easy to miss, and tracker tuning to fit Oracle’s free outbound traffic.
216k peers in production on the free server; ~120k on average within the free monthly traffic
2 cores, 12 GB Always Free Ampere A1
2 days from the first commit to production
€0 per month
Why existing trackers were not enough
We measured both candidates on the same 2-core Ampere A1 server, serving real P2P Media Loader viewers. Every peer keeps one WebSocket connection, so peers and connections are the same thing here.
- Aquatic, a multi-threaded Rust tracker that we recommended for the 4-core free tier, used 1.46 of the 2 cores and 1.9 GB of memory at about 42,000 peers. That leaves room for maybe 55,000–60,000 peers, not 100,000.
- wt-tracker, our own tracker on Node.js and µWebSockets.js, is very efficient per core. But Node.js runs it on one core, so on a 2-core server half of the CPU stays idle.
We needed wt-tracker’s efficiency on every core.
wt-tracker-rust: ported with AI in two days
wt-tracker-rust is a port of wt-tracker to Rust. We built it with AI-assisted development: AI coding agents wrote most of the code, while our engineers set the goals, made the design decisions and reviewed every change. From the first commit to real viewers in production took two days.
Speed did not come at the expense of correctness. The port is driven by a written specification and checked from several sides:
- Differential testing against the original: random message sequences go through both trackers, and wt-tracker-rust’s replies must be byte-identical to wt-tracker’s.
- Twin benchmarks: every Rust benchmark has an identical JavaScript twin running against wt-tracker.
- The full WebSocket conformance suite: all 517 cases of the Autobahn testsuite pass, with and without compression.
- Fuzzing of the WebSocket framing, compression, HTTP upgrade and tracker protocol, plus property-based tests of the tracker state.
- CI runs all of it on every change, and longer fuzzing every night.
The design keeps what made wt-tracker fast and adds every CPU core:
Every peer keeps a WebSocket connection open. Each core runs a worker with its own WebSocket layer and its own swarms, and a connection moves to the worker that holds its stream.
- One worker per core, no locks: each worker owns its own share of the swarms and never waits for another thread.
- Swarms follow the content: the video, audio and every quality of one stream are kept on one worker, and a viewer’s connection moves to that worker at its first announce. Almost every message is then handled on a single core, with no traffic between threads.
- Zero-copy messages: WebRTC offers and answers are forwarded as slices of the received message, never copied or re-encoded.
- Its own WebSocket implementation instead of µWebSockets: like µWebSockets, it reads every connection through one shared buffer per worker, so a connection costs about 12 KB of memory with TLS (5–9 KB over plain WebSocket in our load tests). Because we control it, it can do something µWebSockets doesn’t offer: move a live connection, TLS session included, to another core. That is what lets swarms follow the content.
- A drop-in replacement: the same configuration file and the same protocol as wt-tracker, plus Prometheus metrics and structured logs.
More about the design is in our wt-tracker case study.
On the same 2-core server and the same real traffic, at about 42,000 peers:
| Aquatic | wt-tracker-rust | |
|---|---|---|
| CPU | 1.46 cores | 0.35 cores |
| Memory | 1.9 GB | 590 MB |
That is 4× less CPU and 3× less memory.
It also beats our µWebSockets.js-based wt-tracker on its home ground. In our load tests on a single core, wt-tracker-rust needs up to a third less CPU per message and about 3–5× less memory per connection, and it scales to every core on top of that.
The CPU is no longer the problem, but two other limits showed up.
Step 1: Make Oracle’s network rules stateless
At about 40,000 peers the server seemed to hang. SSH stopped responding, and new viewers couldn’t connect. Yet the server itself was healthy: its logs were clean, the CPU was mostly idle, and the viewers already connected kept working.
The cause was Oracle’s network layer, not the server. By default, the security list rules of an Oracle Cloud subnet are stateful: Oracle tracks every connection to remember that its replies are allowed. That tracking table has a limit per instance. With tens of thousands of long-lived WebSocket connections it fills up, and Oracle silently drops new connections before they reach the instance. In our measurements about 80% of new TCP connections timed out.
The fix is to make the tracker’s rules stateless. Stateless rules are checked packet by packet, with no tracking table, so replies need their own egress rules.
In Networking → Virtual cloud networks → your VCN → Subnets → your subnet → Security, edit the ingress rules and add egress rules:
| Direction | Stateless | Address | Protocol | Source port | Destination port |
|---|---|---|---|---|---|
| Ingress | Yes | 0.0.0.0/0 | TCP | All | 443 |
| Ingress | Yes | 0.0.0.0/0 | TCP | All | 80 |
| Egress | Yes | 0.0.0.0/0 | TCP | 443 | All |
| Egress | Yes | 0.0.0.0/0 | TCP | 80 | All |
Keep the SSH rule and the default egress rule stateful: the server’s own connections (updates, certificates) still need them. After the change every new connection got through, and the server accepted several times more new connections per second.
Step 2: Fit the free 10 TB of monthly egress
Oracle’s Always Free Tier includes 10 TB of outbound traffic per month: an average of about 3.86 MB/s, or 31 Mbit/s. Inbound traffic is free. For a tracker this is the real limit, not the CPU.
We measured where the outbound traffic went:
| Outbound traffic | Share |
|---|---|
| Tracker messages (mostly WebRTC offers and answers) | 54% |
| TLS handshakes of new connections | 25% |
| TCP/IP headers and acknowledgments | 18% |
| WebSocket framing | 3% |
Three changes reduced it.
Compress outgoing offers. Browsers already negotiate WebSocket compression (permessage-deflate) and compress what they send. wt-tracker-rust also compresses its outgoing messages above a size threshold. A WebRTC offer is about 1 KB of text and compresses well. Turning this on cut the server’s outbound traffic by 27%, with no measurable CPU cost.
Resume TLS sessions. A viewer reconnects every few minutes, when it switches streams or its network changes. A full TLS handshake sends the certificate chain, about 3.7 KB. With TLS session tickets, a reconnecting viewer resumes its previous session in about 0.2 KB. wt-tracker-rust now issues session tickets by default, and the outbound overhead per new connection dropped by 39%.
Send fewer messages. The announce interval and the number of offers per announce set the message rate. Peers re-announce every 3 minutes, and the tracker forwards up to 5 offers per announce, the same limit the official WebTorrent client uses. Most announces get fewer: a small swarm has fewer peers to offer to. The limit matters in big live events, where large swarms would otherwise multiply the offers and answers.
The settings we use:
{
"servers": [
{
"server": {
"host": "0.0.0.0",
"port": 443,
"cert_file_name": "fullchain.pem",
"key_file_name": "privkey.pem"
},
"websockets": {
"path": "/*",
"maxPayloadLength": 65536,
"idleTimeout": 190,
"compression": 1,
"compressOutgoingMinSize": 256
}
}
],
"tracker": { "maxOffers": 5, "announceInterval": 180 },
"workers": 2,
"reusePort": true
}
After tuning, one peer costs about 31 bytes per second of outbound traffic (29–34 B/s in production). That gives 3.86 MB/s ÷ 31 B/s ≈ 120,000 peers on average within the free 10 TB.
How many peers can the server handle?
The server is our public tracker, wss://tracker.novage.com.ua. P2P Media Loader announces to it by default, so its peers are viewers on sites that use P2P Media Loader, and any WebTorrent-compatible client can connect to it too.
In production on 17–19 October 2026, wt-tracker-rust reached 216,000 peers (243,000 secure WebSocket connections) and served 150,000 peers on average over two days on the same free server. At the peak it used 1.45 of its 2 CPU cores in total, 2.9 GB of memory for the whole process (about 12 KB per connection, TLS included) and about 7 MB/s of outbound traffic. The free traffic is a monthly budget, so days above the average of 120,000 are fine as long as the month evens out.
The limits of the free server:
| Limit | Peers it allows |
|---|---|
| CPU (2 cores) | ~216,000 (one core full) |
| Memory (12 GB) | 500,000+ (estimated) |
| Network bandwidth (2 Gbps) | far above any of these |
| Free outbound traffic (10 TB / month) | ~120,000 on average |
The CPU limit is reached when one worker’s core is full, not when both are. Popular content stays on one worker, so the load is never split evenly. At 216,000 peers, one worker served 115,000 peers and was 97% busy, while the other served 101,000 and was 45% busy. A single huge live event reaches the limit even earlier: on another night, one worker was full with 58,000 of its own peers, at 99,000 peers in total.
So the free server’s hardware handled 216,000 peers, at the limit of its busier core. What limits it to about 120,000 on average is the free outbound traffic. Beyond that, extra traffic is billed per gigabyte: at Oracle’s list price for North America and Europe at the time of writing, $0.0085 per GB, an average of 216,000 peers (about 17 TB a month) would cost about $60 a month. The same free instance can grow with your audience without a larger server.
These numbers are measured once a minute in production. Memory and traffic grow linearly with the number of peers.
Run it yourself
-
Create an Ampere A1 instance with 2 cores and 12 GB of memory in the Always Free Tier.
-
Make the ingress rules for ports 80 and 443 stateless and add the matching egress rules (see Step 1).
-
Open ports 80 and 443 in the instance’s firewall and get a free TLS certificate from Let’s Encrypt.
-
Build and run wt-tracker-rust with the settings from Step 2.
-
Point P2P Media Loader at your tracker’s
wss://address with theannounceTrackerssetting, for example with hls.js:const hls = new HlsWithP2P({ p2p: { core: { announceTrackers: ["wss://tracker.example.com"] }, }, });
Installation and every setting are described in the README on GitHub. wt-tracker-rust is free and open source under the Apache-2.0 license, and it works with any WebTorrent-compatible client, including the WebTorrent client itself.
Conclusion
A free 2-core server can be the tracker for a P2P video audience of more than 100,000 simultaneous viewers: ours served 216,000 at the peak, and about 120,000 on average fit the free traffic. It takes three things: a tracker that uses every core efficiently, stateless network rules so Oracle’s connection tracking doesn’t drop viewers, and tuning that keeps outbound traffic within the free 10 TB.
With P2P Media Loader offloading most of the traffic from the CDN and a free server introducing more than 100,000 viewers to each other, a large P2P video audience no longer needs a large budget.
It also shows what AI-assisted development can do when it is held to a high bar. A specification, differential tests against the original and conformance suites let us port a production server to a new language in two days, and run it on real traffic right away.
If you need P2P video delivery, tracker infrastructure, or a backend rewritten to do more with less, get in touch.