Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

python - APNs being really slow (100 - 200ms per notification)

I've noticed this issue with APNs recently when I was migrating my library I'm also using for one of my projects, to use the new token-based authentication and the httpx library instead of hyper. The situation was the same before and after the update, so the changes didn't make a difference.

Here is a snippet from the logs where it's clearly visible:

Sending notification: 515 bytes b'***'.
Response received: 200 (success).
Sent: 227ms.
Sending notification: 515 bytes b'***'.
Response received: 200 (success).
Sent: 184ms.
Sending notification: 515 bytes b'***'.
Response received: 200 (success).
Sent: 186ms.

If you'd also like to look into the code, here is the library: https://github.com/kukosk/pyapns_client

The VPS I'm using is really powerful (16 cpu cores, 96GB RAM, ...) and the connection should also be good as it's a Linode server running in Dallas. The pings to apple.com are ~1.5ms in average.

I really don't see any reason why it could be that slow as the speeds I should be expecting can't really be compared to what I'm seeing. Might Apple be throttling me for some reason?

Thanks in advance for any pointer whatsoever that could lead me to the solution or explanation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...