Big files over Tor were slow, and it was our fault: termchat.app 0.45–0.49
30 November 2026
Six releases went out today, 0.45 to 0.49. Two more, 0.48.0 and 0.48.1, were built and never shipped, because a review found things to fix first. Most of it is quiet work. One part turned out to be a nice little story, so let’s start with that.
“Tor is slow, nothing to do”
That was my first guess. A 20 MiB document over Tor took about five minutes. The same file without Tor took 37 seconds. I was about to write one honest line in the docs, “big files are slower over Tor”, and move on.
Then I measured it properly, with two test accounts on the public relay and the same file each time:
- nobody on Tor: 37 seconds;
- the receiver on Tor: 107 seconds, about three times slower;
- the sender on Tor: about five minutes, eight times slower.
If Tor’s bandwidth were the limit, the receiver would suffer just as much as the sender. It didn’t. So the limit was somewhere on the sending side, and the sending side is our code.
One piece per round trip
A large document goes as pieces of 64 KB each. The app sent one piece, waited for the relay to answer “got it”, and only then sent the next one. Without Tor that wait is a few dozen milliseconds, so nobody noticed. Over Tor a round trip to the relay’s onion address takes almost a second. One piece a second is about 64 KB/s, which is exactly what I saw.
We didn’t do this by accident. Sometimes the relay refuses a piece for a moment: the queue hit its rate limit, or it’s full. The app then sends the same piece again a bit later. If the next piece were already on its way, it could get in first, and the receiver only accepts pieces in order. A piece out of order cancels the whole transfer with “did not arrive whole”. Waiting for every answer was the simplest way to never let that happen.
Let the relay keep the order
The fix in 0.49 moves that job to the relay. When it refuses a piece, it remembers it, and refuses every later piece on the same connection to the same queue until the refused one comes back and is accepted. The refused ones aren’t stored and don’t count against any limit. The memory is per connection and goes away with it.
Now order is safe even with several pieces on the way, so the app keeps up to eight. Eight pieces at our usual pace cover a round trip of about a second, which is Tor’s. After a refusal it sends only the refused piece until the relay takes it, and then opens up again.
On a test setup with the same 0.9 second round trip as Tor, the same 20 MiB went from 5 minutes 2 seconds to 39 seconds. That’s about eight pieces a second, right at the pace the relay allows. Then the real thing, after the public relay got 0.49: the same 20 MiB from a sender on Tor took 65 seconds instead of about five minutes. That’s about five pieces a second; the rest of the gap is the Tor circuit itself, which differs from day to day, so your number will vary.
What didn’t change: the encryption, the size of the pieces, the bytes on the wire. There’s no new protocol level either. The receiver can run any version, because the relay hands pieces over in order. Only the sender and the relay need 0.49. If you run your own relay, the app notices its version and keeps the old one-at-a-time pace until you update it.
The decision, with the measurements and what we rejected, is in ADR-054.
Your phone writes a lot less
Before 0.48.2 the app saved its whole encrypted state after every incoming message, before telling the relay the message arrived. That means every Olm session, the whole history, encrypted and flushed to disk. One message in, megabytes written. A chatty contact makes the phone write its flash over and over, and someone who wants to can do it on purpose.
Now incoming messages are saved together, at most once a second, and the relay hears they arrived with the next save. If the app crashes in between, up to a second of messages arrives again. That’s fine, because the relay only deletes what was saved. Details in ADR-053.
Smaller things worth knowing
ask-secret got stricter. If someone answers your secret question too late, after a daemon restart or twice, the value is thrown away instead of quietly staying in the chat history. They get a short note saying why it wasn’t used.
Relay operators can turn on numbers for Prometheus with --metrics-listen 127.0.0.1:9464. These are relay-wide only: connections, queues online, bytes waiting, errors by code. No queue IDs, no addresses, loopback only, off by default.
Group invites now reach all of a person’s devices or none. Before, if the relay refused a reader for one of their devices, that person could stay “invited” forever with no invite actually sent.
On Android, picking, sharing and saving big documents doesn’t freeze the app anymore, even when a cloud provider takes its time to hand over the file.
Arch and Omarchy
There’s now a termchat-app-bin recipe in docs/aur/. The plain termchat name in the AUR belongs to another project, so the commands are termchat-app and termchat-app-gui. It’s tested on a clean Arch install: it builds, installs, starts from the launcher and uninstalls cleanly. I’d put it in the AUR right away, but AUR registration is closed for now because of a wave of bot signups. Until it opens, makepkg -si in that folder does the same job. If you’re on Omarchy and give it a try, I’d love to hear how the launcher entry and notifications behave.
The full list is in the changelog.