RobotsAndPencils / buford

A push notification delivery engine for the new HTTP/2 APNS service.
MIT License
475 stars 52 forks source link

push: recommendation for number of goroutines / streams #69

Open nathany opened 8 years ago

nathany commented 8 years ago

Apple allows between 400 to 4000 streams.

net/http2 is hard coded at 1000 streams (maxConcurrentStreams): https://github.com/golang/net/blob/313cf39d4ac368181bce6960ac9be9e7cee67e68/http2/transport.go#L409 (thanks to @sideshow for pointing this out)

In addition to streams, multiple connections can be used. From Apple docs:

You can establish multiple connections to APNs servers to improve performance. When you send a large number of remote notifications, distribute them across connections to several server endpoints. This improves performance, compared to using a single connection, by letting you send remote notifications faster and by letting APNs deliver them faster.

You can check the health of your connection using an HTTP/2 PING frame. Docs

nathany commented 8 years ago

Two related issues:

https://github.com/golang/go/issues/13957 https://github.com/golang/go/issues/13774