# Chat SDK Scalability and Cost ## Firebase Realtime Many people want to know how much Chat SDK will cost in terms of hosting. With Firebase Realtime, the cost is primarily determined by the data bandwidth you use. Firebase charges $1 per GB of transfer. So the first step is to look how much data the chat users. There are two ways we can estimate the usage. We can **profile** the Chat SDK in test scenarios and we can look at **real-world** cases. ### Data profiling Firebase has a really nice [profiling feature](https://firebase.google.com/docs/database/usage/profile) which can be used to determine the Chat SDK's data footprint. Here are the results from some profiling we did: Login: 850 bytes Search for user: 1.5kb (1 user in list) Create Thread (1-to-1): 2.2kb **1-to-1 chat** Send message (1 char): 1.75kb Send message (10 char): 1.75kb Send message (100 char): 2.0kb **Group Chat 3 users** Create Thread (3 user group): 3kb Send message (1 char): 3.2kb Send message (10 char): 3.2kb Send message (100 char): 3.7kb Since 1GB = 1 million KB it's easy to estimate the cost: | Action | Cost | | -------- | -------- | | Send 1 million 100 char messages | $3.7 | | Login 1 million times | $0.85 | | Create 1 million 1-to-1 chats | $2.2 | | Create 1 million group chats | $3 | You can even verify this for yourself and run your own test cases. ### Real-world Cases I've worked with a number of companies who use Chat SDK at scale. Because of confidentiality, I can't provide the names or exact details of these companies, but I can pass on an estimate of the cost of running Chat SDK at scale. #### Case Study - Logistics Company This company use Chat SDK for logistics, connecting their agents with their customers. | Statistic | Number | | -------- | -------- | | Monthly Active Users (MAU) | 5 million + | | Daily Active Users (DAU) | 500k | | Concurrent Users | 25k | | Data used | 1000 GB per month | That equates to around $1000 in hosting fees per month which is $200 per 1 million MAU. This may seem high but it's actually very low compared hosted messaging solutions. ### The Alternatives | Company | MAU | Cost per month | Cost per 1 million MAU | | -------- | -------- | -------- | -------- | | [Quickblox](https://quickblox.com/pricing/) | 25k | $399 | $16k | | [Twilio](https://www.twilio.com/pricing) | 25k | $1750 | $70k | | [SendBird](https://sendbird.com/pricing) | 25k | $3499 | $140k | | [Applozic](https://www.applozic.com/messaging-api-price.html) | 100k | $499 | $5k | When I made this table I was honestly astonished by the cost. These services seem so expensive, I feel like there must be some mistake. If you see any error I've made, please leave a comment! Assuming the above figures are correct, even if the Chat SDK used 10x more data than it does, it would still be the cheapest solution! If we look at SendBird for example, for the monthly price they charge for 25k MAU, you could get 3500 GB of data transfer with Firebase. That's 140mb per user! Since the average message is 5kb, each user would need to send around 28k messages per month for this to equal the cost of Firebase. ### How is Chat SDK so cheap? The point is that **Chat SDK isn't particularly cheap**. If you hosted your own XMPP server, it would be much cheaper than Chat SDK with Firebase. The main point is that dedicated messaging providers are just very, very, horribly expensive. Firebase is a generic platform and Google are competing with services like Amazon Web Services. So they offer competitive prices for data. The messaging marketplaces is extremely competitive so those companies need to spend a lot on advertising. They also have investors so they need to make a profit in a way that a company like Google which makes most of it's money from advertising, doesn't need to. ### Chat SDK Longevity Chat companies shut down all the time: - [Layer](https://blog.contus.com/layer-shutting-down/) - [Pusher Chat Kit](https://support.pusher.com/hc/en-us/articles/360007301477-Chatkit-Decommissioning-FAQ) People ask me how long Chat SDK will be around. The thing is that I'm developing Chat SDK out of love rather than to make a fortune. I'm an expert in messaging with over 10 years development experience so I could make $$$ if I chose to work for a company. But I chose the red pill instead and now I travel Europe in a van while developing Chat SDK! If you want to know more, read the [about me](https://hackmd.io/dTS9cH0qTDq-KVU67bqDeg?both) post. I live on under $2k per month and I have the funds to work full-time on Chat SDK for at least the next 2 years. Even longer with Paetron support. Firebase is getting bigger and bigger so I think it's unlikely it's going out of business any time soon. Chat SDK and Firebase is a much more secure technology stack than other messaging platforms. So if you like the project and want to support independent developers, support us on [Patreon](https://www.patreon.com/chatsdk). Even with the cost of supporting us, you will still save a lot on hosting!