Beating AI News Flash: Ghostty author Mitchell Hashimoto has published scalability tests for his new terminal, Rex. Rex focuses on long-lived sessions and remote connectivity, allowing terminal tasks to keep running in the background. In this test, Rex maintained 10,000 active terminal sessions simultaneously, using about 3.8GB of memory, while interactions remained responsive. The team has not yet pushed the test further; the next target is 100,000.
After reaching 10,000, much of the overhead was no longer caused by the terminal itself. The first bottleneck came from Linux's file descriptor table, the place where the system records files and connections opened by processes. Once terminal sessions exceeded about 5,000, each new process would consume about 512KB just for this table, even though only about 4 file descriptors were actually used. Rex has now added a piece of C code to shrink that space back to what is actually needed.
Another issue is threads. Rex used to have each active terminal session occupy its own thread waiting for data, and at scale the memory overhead became too high. Now, if a terminal has no read activity for 2 consecutive seconds, it is handed over to a shared thread for unified monitoring.

