Really need to read the Optimization & Performance Guide on this one. I think it’s more that the Relay can support 5000 endpoints given the cores/RAM, AND you’ve applied the OS tuning for the relay (shortening the TCP TIME_WAIT delay, increasing the range of Ephemeral ports, etc.)
FWIW, I’ve already relays running up to 2000 clients per each, having applied most of the OS tuning several years ago. It’s not a recommended configuration, but it’s always been “possible” though your mileage may vary of course.
I think there’s also stuff in the guide about tuning reporting frequency on the clients, batch counts on the relays, etc.