|
|
|
|
|
by jondubois
3877 days ago
|
|
Long polling is a hack. Anyone who has had to scale it across more than a single CPU core on a single machine will know this. TCP and WebSockets are stateful, HTTP is stateless.
So long polling is essentially: Stateful -> Stateless -> Sateful You start in a good place, then you add complexity to make it stateless and then you add even more complexity to roll back the statelessness and then you end up where you started... Except it's 90% slower and you now have to use an armada of sticky load balancers to prevent the system from falling apart... |
|
In Go, requests are a single goroutine, dirt cheap (no problem with a single CPU). To me, this type of work is where Go excels.
I used SSE (not quite long polling but I think it has the same implications as far as this discussion goes) back in Go 1.3 days (so GOMAXPROCS=1) to write metrics to 100<n<1000 clients and the process barely registered CPU or memory usage. No lock problems either (copying metric values over channels).
As far as complexity .. well, sure, if you fuck up the design or use the wrong tool for the job you'll have problems.