Ably accounts are priced based on the number of messages, the total bandwidth used, and the number of peak connections within any calendar month. There is also a default channel limit applied to different account types and is currently not configurable manually by customers. Find out more about default channel limits on accounts and why Ably imposes channel limits on accounts and how to increase your limits.
The peak channel figure is the total number of open channels at any point in time 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 peak 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
- At least two minutes has passed since the last message was published. We keep channels alive for two minutes to ensure that we can provide continuity on the channel as part of our connection state recovery.
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 peak number of channels would be the sum of the 500 unique channels per client and the one global shared channel i.e. 501 peak 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 peak channel count as peak channels is the concurrent number of channels 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 (peak) 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 channels existence, and also notifies the app when the channel is closed automatically when it becomes inactive. These counts are updated when they change in a hash 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, peak 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.
- Find out more about default channel limits on accounts
- Find out why Ably imposes channel limits on accounts and how to increase your limits