reusePort option in Bun.serve() which shares the same port across multiple processes.
This automatically load balances incoming requests across multiple instances of Bun.
server.ts
Linux only — Windows and macOS ignore the
reusePort option. This is an operating system limitation with
SO_REUSEPORT, unfortunately.SO_REUSEPORT and SO_REUSEADDR socket options to ensure fair load balancing across multiple processes. Learn more about SO_REUSEPORT and SO_REUSEADDR
cluster.ts
Bun has also implemented the
node:cluster module, but this is a faster and more limited alternative.