What are the differences between Units, Instances and Messages? How Microsoft counts them and how can they affect your expenses? Learn about the different pricing options for Azure SignalR Service, including the number of concurrent connections, units, instances, & messages per day.
Pricing board
According to Azure there are 3 options in terms of pricing:
Premium:
- 1,000 connections, 1,000,000 messages per day included
- Autoscale* included
- Estimate unit cost 61.00 USD per month, 1.00 USD per million messages
Standard:
- 1,000 connections, 1,000,000 messages per day included
- No autoscale*
- Estimate unit cost 49.10 USD per month, 1.00 USD per million messages
Free:
- 20 connections, 20,000 messages per day included
- No autoscale
- 0 USD
Instance vs Unit: What is the difference?
Quick explanation
Instance: A SignalR instance is what you need to create in Azure first to use SignalR.
Unit: A sub-instance that processes your SignalR messages. Units are used to increase the performance and connections count.
More about Instance
After visiting Azure Portal and going in SignalR service page, by selecting the Add button you are creating an instance. This is the very first step to using SignalR.
More about Unit
Think unit this way: Let’s say you have a web server that is not enough to handle the web traffic. You can add two more servers to balance the traffic. This increases the performance and number of requests your environment can handle. In this example, the environment is an INSTANCE. Each server is a UNIT. Before adding new servers, you have 1 instance and 1 unit in that instance. After adding new servers, you have 1 instance and 3 units in that instance.
How Azure SignalR Service pricing works?
Long story short:
- In Free plan, you can use only 1 Unit, this unit can handle up to 20 Concurrent Connections and can share up to 20.000 messages per day.
- In Standard plan, you can use up to 100 Units (no autoscale), each unit can handle up to 1.000 Concurrent Connections and can share Unlimited messages (with extra cost).
- In Premium plan, you have the same with Standard but units can autoscale.
Important details:
First of all, be aware that the SignalR pricing model, on the Microsoft website, is explained per Unit per day. Secondly, be aware for SignalR that 1 message is not exactly one message. Are you confused about this? No problem, bellow is the explanation and some examples
How SignalR message counted for billing
I can hear you wondering, which messages (inbound, outbound, etc.) are counted towards the quota? And how did Azure count them for billing?
Well, fortunately only outbound messages are counted for billing. Ping messages between clients and servers are ignored. But, messages larger than 2 KB are counted as multiple messages of 2 KB each. You can read more details here.
Here are three examples on how SignalR messages counted for billing
Example 1:
- You have 1 client and 1 application server.
- The client sends a 1 KB message to the server and then the message sent from the server to the client.
- The message count is 2: 1 message from the client to the server and 1 message from the server to the client.
Example 2:
- You have 3 clients and 1 application server.
- One client sends a 4 KB message to the server, which is then broadcast to all clients.
- The message count is 8: 1×2 message from the client to the server and 3×2 messages from the server to each of the clients.
Example 3:
- You have 10 clients and 1 application server.
- One client sends a 10 KB message to the server, which is then broadcast to all clients.
- The message count is 55: 1×5 message from the client to the server and 10×5 messages from the server to each of the clients.
As you can see, the message count is calculated based on the number of outbound messages from the Azure SignalR Service. Ping messages between clients and servers are ignored, and messages larger than 2 KB are counted as multiple messages of 2 KB each.