java - Server Sent Event (SSE) cluster connection handling -


at work we're building webapp supports sse.
we're relatively new sse, we're dealing lot's of (newbie) questions:

disconnected connections

when client closes browsers end disconnected connection. call ghost connections think. how can detect such connections @ server side? want delete clients notification list.

limit amount of connections

i understood each 'sse-connection' kept alive on application server. when shut down development server, directly notice on browser debugger connection felt away. shouldn't set upper limit of connections? the application server connections exhausted time...
additionally, server dedicate thread each request. lead thread exhausting issue...

application or web server

should whole sse-broadcasting managed application server (where request business related) or should managed web server dedicated handling sse-event? @ moment, business request , sse-events handled jboss application server.

clustered environment

how sse managed in clustered environment applying active-active mode (=master-master) requests routed randomly between instances?

if have more useful information (and caveats out for) please feel free share!

clustered environment

managing server-sent event application not different managing traditional web application. can use load balancer manage clustered environment , implement auto-scale mechanism continue serving connections when reach instance limit.

the important point should careful @ being sure you're using proxy can keep connection open indefinitely: haproxy , nginx candidates.

limit amount of connections

some server recycle threads (undertow example) , don't. once know how server chose dealing threads, can calculate limit per instance.

application or web server

except if application server manages "classic" business related requests heavily used, there no need have dedicated server manage sse-events.

disconnected connections

concerning disconnected connections, can test them regularly sending called "heartbeat" : empty message return error if connexion has been closed customer.


Comments