-
Notifications
You must be signed in to change notification settings - Fork 470
Description
According to the APNs docs:
You may establish multiple connections to the same gateway or to multiple gateway instances. If you need to send a large number of push notifications, spread them out over connections to several different gateways. This improves performance compared to using a single connection: it lets you send the push notifications faster, and it lets APNs deliver them faster.
No further guidance is given as to how that might happen, though. We had previously assumed that connection-spreading would happen automatically, but that does not appear to be the case in testing. It looks like there are a number of IPs associated with the gateway's DNS entry:
$ dig gateway.push.apple.com
; <<>> DiG 9.8.3-P1 <<>> gateway.push.apple.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64507
;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;gateway.push.apple.com. IN A
;; ANSWER SECTION:
gateway.push.apple.com. 181 IN CNAME gateway.push-apple.com.akadns.net.
gateway.push-apple.com.akadns.net. 3 IN A 17.172.232.33
gateway.push-apple.com.akadns.net. 3 IN A 17.172.232.30
gateway.push-apple.com.akadns.net. 3 IN A 17.172.233.149
gateway.push-apple.com.akadns.net. 3 IN A 17.172.232.35
gateway.push-apple.com.akadns.net. 3 IN A 17.172.232.231
gateway.push-apple.com.akadns.net. 3 IN A 17.172.233.155
gateway.push-apple.com.akadns.net. 3 IN A 17.172.233.147
gateway.push-apple.com.akadns.net. 3 IN A 17.172.238.221
To spread connections across multiple gateways, it seems like we'll need to do our own DNS resolution and connect directly by IP.