Live data from Hacker News

High-Throughput Game Message Server with Python WebSockets

mortoray.com

31–40 of 61 posts

Re: High-Throughput Game Message Server with Python WebSockets

#31

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

There are a few websites which aggregate VPS offers, for example https://lowendbox.com/ or https://lowendstock.com/

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.

Re: High-Throughput Game Message Server with Python WebSockets

#32
post #26
post #17

Might as well plug the game server I wrote over the summer. It's a python UDP server that I was able to scale to over 100 concurrent users based on various sources, but mostly the Gaffer On Games blog. I chose python because I wanted game development to be fun. Ultimately, I couldn't find an existing python framework for multiplayer games that scaled well to my needs. [1] https://pypi.org/project/mpgameserver/

did you consider using AWS eventing in API Gateway https://aws.amazon.com/blogs/compute/announcing-websocket-ap... ?

I have not used AWS and I am not sure if I understand the pricing structure, but wouldn't it cost like $30,000 per month if the server is running at 12k messages/second?

https://aws.amazon.com/api-gateway/pricing/

Re: High-Throughput Game Message Server with Python WebSockets

#33
post #26

Earlier quoted context omitted.

did you consider using AWS eventing in API Gateway https://aws.amazon.com/blogs/compute/announcing-websocket-ap... ?

I have not used AWS and I am not sure if I understand the pricing structure, but wouldn't it cost like $30,000 per month if the server is running at 12k messages/second? https://aws.amazon.com/api-gateway/pricing/

At this point I feel like that most AWS services are for marketing purposes. The type of people who would pay 30k a month for 12k msg/s are very few.

It's just there so you can awe developers at the breath of services AWS provides.

Re: High-Throughput Game Message Server with Python WebSockets

#34

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

Hetzner and a few others will go a bit cheaper than DigitalOcean. Scaleway used to but have hiked prices of their cheapest instance.

Re: High-Throughput Game Message Server with Python WebSockets

#35

Author contemplating an eventual C++ rewrite, but this is a perfect use case for Rust. When you want performance and where memory mistakes can be a serious security problem.

Just wrote a websocket server in Rust. Turned out really easy.

Re: High-Throughput Game Message Server with Python WebSockets

#36
post #4

Author contemplating an eventual C++ rewrite, but this is a perfect use case for Rust. When you want performance and where memory mistakes can be a serious security problem.

Or java

I used to be on the java hate train, but honestly the JVM is magic for infra. I worked at AWS, and I groaned so hard when I started. Then, I came to appreciate it because of the tooling and the types of issues that actually cropped up.

This may also be stockholm syndrome.

Re: High-Throughput Game Message Server with Python WebSockets

#37
post #8

Earlier quoted context omitted.

Or F#/C#. Rust will have memory fragmentation over time.

Memory fragmentation is generally a problem for pets, not cattle. In 90% of use cases it’s nothing that frequently reaping processes won’t fix. This works regardless of language, as it pushes the job of garbage collection onto the os. Another nice feature of treating your processes like dirt is that you tend to get high fault tolerance and scalability as emergent properties.

I really think it's a good solution for many cases but I haven't seen any server-side web framework that implements a kill-the-process-often strategy.

Do you know of any? If so, when do they decide to kill the process and how do they handle client disconnect?

Re: High-Throughput Game Message Server with Python WebSockets

#38

Nice write-up. While it's not appropriate for every game, UDP based networking may offer another order of magnitude improvement over (TCP-based) websockets. WebRTC can be used for unreliable datagrams.

I intend on adding WebRTC as a channel for higher volume discarble messages, such as the cursor position of all players.

Re: High-Throughput Game Message Server with Python WebSockets

#39

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

I'm running a $2/month xmpp server on IONOS [1], so far didn't have a single outage.

However, they can slap 20% vat tax above that if you are in certain jurisdictions, making it $2.40 for EU customers.

[1]: https://www.ionos.com/servers/vps#packages

Re: High-Throughput Game Message Server with Python WebSockets

#40

Earlier quoted context omitted.

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

Vultr has $2.50/mo USD VPS if you're okay with ipv6-only... that's the lowest I've ever come across.

See IONOS, I provided a link in a reply to parent comment.
Post reply on HN