Looks like a perfect case for erlang. And while we are at it, one of existing xmpp servers written in erlang. One puny $2/month server will serve thousands of users without sweating.
I feel like I have to ask: where are you getting a server that'll run arbitrary erlang code for 2 bucks a month? The absolute cheapest I've seen seems to be 5, from digitalocean/linode
However, you usually get what you pay for, so be prepared for
- long and frequent server outages
- tech support which takes weeks to respond or no tech support at all
- IP changes without warning
- system images which have last been updated 5 years ago
- machines which simply fail to reboot
- retroactive contract changes, e.g. introduction of a "maintenance fee" for already paid services (cloudatcost)
- customer support logging in as root into your machine from Indian IP addresses and changing random system settings
But if you are not concerned about the privacy, integrity or availability of your services, you can often find offers for about $1 per month.