Skip to content

Commit 7588e8f

Browse files
committed
Add notes on speed
1 parent 7a58eb3 commit 7588e8f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ APNS/2 is a go package designed for simple, flexible and fast Apple Push Notific
77
## Features
88

99
- Uses new Apple APNs HTTP/2 connection
10+
- Fast - See [notes on speed](https://github.com/sideshow/apns2/wiki/APNS-HTTP-2-Push-Speed)
1011
- Works with go 1.6 and later
1112
- Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications
1213
- Supports persistent connections to APNs
1314
- Supports VoIP/PushKit notifications (iOS 8 and later)
14-
- Fast, modular & easy to use
15+
- Modular & easy to use
1516
- Tested and working in APNs production environment
1617

1718
## Install
@@ -136,6 +137,16 @@ res, err := client.PushWithContext(ctx, notification)
136137
defer cancel()
137138
```
138139

140+
## Speed & Performance
141+
142+
Also see the wiki page on [APNS HTTP 2 Push Speed](https://github.com/sideshow/apns2/wiki/APNS-HTTP-2-Push-Speed).
143+
144+
For best performance, you should hold on to an `apns2.Client` instance and not re-create it every push. The underlying TLS connection itself can take a few seconds to connect and negotiate, so if you are setting up an `apns2.Client` and tearing it down every push, then this will greatly affect performance. (Apple suggest keeping the connection open all the time).
145+
146+
You should also limit the amount of `apns2.Client` instances. The underlying transport has a http connection pool itself, so a single client instance will be enough for most users (One instance can potentially do 4,000+ pushes per second). If you need more than this then one instance per CPU core is a good starting point.
147+
148+
Speed is greatly affected by the location of your server and the quality of your network connection. If you're just testing locally, behind a proxy or if your server is outside USA then you're not going to get great performance. With a good server located in AWS, you should be able to get [decent throughput](https://github.com/sideshow/apns2/wiki/APNS-HTTP-2-Push-Speed).
149+
139150
## Command line tool
140151

141152
APNS/2 has a command line tool that can be installed with `go get github.com/sideshow/apns2/apns2`. Usage:

0 commit comments

Comments
 (0)