dunglas/mercure

Skipped event induce lag in event stream

TibboddiT opened this issue · 1 comments

Sometimes one event is skipped, then there is a one event lag for few events, and then two events are received simultaneously.

Like this :

Publisher Subscriber
Ev. A
Ev. A
Ev. B
Ev. B
Ev. C
Ev. D
Ev. C
Ev. E
Ev. D
Ev. F
Ev. E
Ev. F

Some infos :

  • cookie based auth
  • events published from a Symfony app
  • reproduced with one and multiple subscribers, at low event rate (1 event per 5 secs)
  • the hub is behind an nginx reverse proxy

Sorry if this is normal behavior, but it seems it is not documented.

Could you provide some guidance to find what could be going wrong here ?

Seems it was a buffering issue.
Solved using proxy_buffering and X-Accel-Buffering.

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

I don't understand why I didn't think about that, seems so obvious now.