Been working hard on Rex server scalability. In short: we were able to run 10,00...
Mitchell Hashimoto @mitchellh@hachyderm.io
Been working hard on Rex server scalability. In short: we were able to run 10,000 active terminals simultaneously with 3.8 GB memory usage while maintaining responsiveness. We didn't try more yet, we want to improve some numbers before going bigger, but the goal is 100,000.
This wasn't free and to get to this point required a lot of very fun engineering challenges! Here are just a couple:
- Linux fork preallocates enough fd table space for the highest open fd at fork time to the nearest power of 2. For terminals beyond ~5000, that was 512KB per terminal process JUST for a fd table that had ~4 fds. We now use a trampoline written in C to unshare the fd table so it shrinks back down to fitting the minimum fds.
- We previously kept all active (non-snapshot) terminals blocked on pty read, but that takes up an OS thread which at this scale uses a prohibitively high amount of RAM. We now move all quiet pty fds (2 seconds without read activity) to a shared epoll thread.
I didn't compare to any other multiplexers at this time. I'm not particularly interested at this state to have relative numbers against others, because the enemy I'm trying to beat is myself. We'll continue to improve these numbers, these are still alpha-quality builds.