Still Showing Online

Presence for 500,000 users is stored as a Redis set written on socket open and removed on the close handler. After a node is OOM killed, tens of thousands of users show as online for hours. What is the durable design?

A

Have each node publish its full connection table to Redis once a minute, and have readers union the most recent snapshot written by every node in the fleet

B

Write presence as a per user key with a short TTL that the owning node refreshes on each heartbeat, so it expires without any explicit removal

C

Register a shutdown signal handler on every node that clears its users from the presence set before the process exits

D

Mark a user offline the first time a message send to their socket returns an error, and clear their entry from the set then