apns2
apns2 copied to clipboard
Add a better connection pool
The default golang http2 connection pool is good but lacks some important features which would be useful for the apns2 library:
- There is currently no way to have a minimum amount of TLS connections open (throughput)
- There is currently no way to have a maximum amount of TLS connections open (avoids exhausing resources). Similarly there is no way to control when connections are opened or closed.
- Connections are currently not opened until the first request is sent - There is currently no way to connect before the first push is sent.
- There is no visibility/stats into how many tcp connections and requests are currently active.
- There is no ability to control pings an keep connections alive from the pool - See issues https://github.com/sideshow/apns2/issues/19, https://github.com/sideshow/apns2/pull/45, https://github.com/sideshow/apns2/pull/51
Ideally we want to write a custom connection pool to address the above issues. It should have reasonable defaults so that no configuration is needed out of the box, but provide the correct settings to customize for those that are using apns2 at scale.
#89 explores some of these requirements, namely:
- [x] There is currently no way to have a minimum amount of TLS connections open (throughput)
- [x] Connections are currently not opened until the first request is sent - There is currently no way to connect before the first push is sent.
- [x] There is no ability to control pings an keep connections alive from the pool