Please note: In legacy Ably packages, these were called 'peak' connections but the concept is the same
Ably accounts are priced based on the total number of messages, concurrent channels and concurent connections within any calendar month.
The concurrent channel figure is the maximum number of channels that were simultaneously open at any point within the month. Whilst a channel physically exists in at least two regions (our servers actively manage open channels), from a customer's perspective, a channel is unique by its name and the number of regions it is physically active in has no bearing on the concurrent channel count.
A channel is opened when any of the following happens:
-
A message is published on the channel via REST
-
A realtime client attaches to the channel. The channel remains active for the entire time the client is attached to that channel, so if you connect to Ably, attach to a channel, and publish a message but never detach the channel, the channel will remain active for as long as that connection remains open.
A channel that is open will automatically close when all of the following conditions apply:
- There are no more realtime clients attached to the channel
- Around a minute has passed since the last activity on the channel (realtime attachment or message published)
As an example, if you have 10,000 users, and at your busiest time of the month there is a single spike where 500 customers establish a realtime connection to Ably and each attach to one unique channel and one global shared channel, the concurrent number of channels would be the sum of the 500 unique channels per client and the one global shared channel i.e. 501 concurrent channels. If throughout the month each of those 10,000 users connects and attaches to their own unique channel, but not necessarily at the same time, then this does not affect your concurrent channel count as concurrent channels is the number of channels simultaneously open at any point of time during that month.
In your account or app dashboard, the graph at the bottom of the page shows the minimum, maximum (concurrent) and average number of channels for the time period. See an example below:
Further technical details on how channels are counted in real time
Each Ably core server that maintains an open channel notifies the app of the channel's existence, and also notifies the app when the channel is closed automatically after becoming inactive. These counts are updated when they change in the set of channels maintained for each datacenter, and the counts and are then rolled up globally once every second i.e. viewing your live channel counts will be inaccurate by at least one second.
If a core server is abruptly terminated and thus all channels migrate to new servers, the corresponding member of the datacenter maintained hash is deleted ensuring we never miscount as a result of an abruptly terminated instance being unable to decrement the central count.
The usage stats for an account or app viewable in your dashboard (which includes message counts, concurrent connections etc) is aggregated every few seconds and persisted to disk in at least 2 regions.
Whenever account aggregates are calculated and persisted to disk, the connections, channels, messages and data used for that month are checked against the account package limits, and an appropriate action is taken if a limit is exceeded i.e. a notification may be sent to Ably staff instructing them to contact the customer, or, in severe cases, new connections or messages will be rejected on that account. Find out more about what happens if you exceed your account package limits.
Further reading
- Find out more about default channel limits on accounts
- Find out why Ably imposes channel limits on accounts and how to increase your limits
- Find out what happens if you hit a channel limit
- Find out how to upgrade your account