Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontally scaling lightyear for high-availability #834

Open
caniko opened this issue Jan 20, 2025 · 10 comments
Open

Horizontally scaling lightyear for high-availability #834

caniko opened this issue Jan 20, 2025 · 10 comments

Comments

@caniko
Copy link

caniko commented Jan 20, 2025

How do we scale lightyear to handle multiple game sessions? If this is not supported yet, I am curious how you plan to implement this in the future

@cBournhonesque
Copy link
Owner

What do you mean by multiple game sessions?
A single server handling multiple game rooms?

I think you can already implement this using the NetworkRelevance/Room feature. (or even just using the ReplicationTarget component)

There is also an example for it here: https://github.com/cBournhonesque/lightyear/tree/main/examples/lobby

@caniko
Copy link
Author

caniko commented Jan 21, 2025

Amazing! This is definitely helpful for smaller projects and prototyping!

How about horizontal scaling on the server-side, thinking about high-availability and failover to other machines. Having a single machine for a live service multiplayer is not exactly production-grade.

@caniko caniko changed the title Scaling lightyear to handle multiple game sessions Horizontally scaling lightyear for high-availability Jan 21, 2025
@cBournhonesque
Copy link
Owner

I think the standard is to have N server processes on a machine with N cores, with each server taking charge of one game room.

But for actually deploying your servers I would advise to use Edgegap; there is also a project to easily be able to onboard bevy to Edgegap called https://github.com/RJ/bevygap !

@caniko
Copy link
Author

caniko commented Jan 21, 2025

I think the standard is to have N server processes on a machine with N cores, with each server taking charge of one game room.

So there is no open source way as of now to orchestrate the scaling towards multiple machines?

But for actually deploying your servers I would advise to use Edgegap; there is also a project to easily be able to onboard bevy to Edgegap called https://github.com/RJ/bevygap !

I am actually exploring building my own PaaS that is tailored for turn-based games.

@cbournhonesque-sc
Copy link
Contributor

Well there is stuff like https://agones.dev/site/
but yes nothing directly integrated with lightyear

@caniko
Copy link
Author

caniko commented Jan 21, 2025

I am actually trying to avoid Kubernetes.

Well there is stuff like https://agones.dev/site/

How would we use wtransport with K8 anyway; for instance, there is no proper traefik support for HTTP3 🤷🏼

@Jieiku
Copy link
Contributor

Jieiku commented Jan 21, 2025

I have used a Proxmox Cluster with a CEPH storage backend to handle redundancy, the high availability failover is seamless.

Proxmox can be used for free, but has commercial support for those that want it.

My proxmox cluster is 5 server nodes in my home server rack.

(It is somewhat older hardware r720, that I bought used, but you could literally use any PCs, and you can put a cluster together with as little as 3 machines)

While I am still testing and building I do not have to pay for hosting.

@Nul-led
Copy link
Collaborator

Nul-led commented Jan 21, 2025

I don't really think it would be lightyears responsibility to provide horizontal scaling support since it's just a networking library in the end.. 🤔

@caniko
Copy link
Author

caniko commented Jan 21, 2025

@Jieiku while this is definitely something like what I had in mind, it is still not perfect because ongoing sessions would die in case of a failover in this stack.

Am I perhaps missing something? Do you cache the Bevy world on CEPH?

@Jieiku
Copy link
Contributor

Jieiku commented Jan 22, 2025

CEPH handles the storage (the storage is redundant across 2 or more machines), and the Proxmox cluster monitors the state of the LXC containers and server nodes. If the server Node went down for any reason then the Proxmox cluster would resume the container(s) on another node. That means any running software within those containers would continue to run as well. I have been using Proxmox for various tasks for the last 7 years or so, but I have not yet launched/released any games. I am just now getting into game development, most of my experience is actually in networking and IT management (business apps, and client services)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants