Usecase:
Assume a game server which is keeping some local state (in memory). If users joining the same room/game are connected to the instance that holds this state, things will be much faster, else if they connect to a new instance, they will have to somehow sync state from a
persistent datastore.
In case of multiplayer games, it is quite possible for players to be joining from very different geos. Usually a single game server closest to the largest cluster of user is selected to run the game logic.
Isnāt this already possible via IPv6 if the external_port feature flag is on? Or does the question relate to IPv4 only? Since this is a game IPv6 might be possible, no?
@hi.kanily Weāve now added a functionality where if you add fly-force-instance-id header to your request, with a value containing an instance id, we will forward the request to that instance only. This should also work with websockets and upgrades if the original request was made with the aforementioned header.
This is a bit of a footgun: we will not try other instances when you provide that header. If the instance is down, the connection will probably hang for a little bit and then close.
@sudhir.j it is possible with the external ports feature, but a shocking number of game clients donāt have IPv6. Thisāll let people do gameservers through a single IPv4, we should setup a demo app with: https://colyseus.io/
interesting. I havenāt really deployed anything yet, but was trying to evaluate how to use Fly. Thanks for the quick support!
@jerome, would it be possible to do something like fly-prefer-instance-id instead of fly-force-instance-id. That would be more graceful and send the redirect to another instance if the one requested is dead. Or is that a technical difficulty you mean?
@sudhir.j, will look into IPv6 - but I admit I am ignorant about it, and itās adoption. So off topic question - do all mobile service providers typically support IPv6 on their 3g/4g networks? Is it possible that some clients may not be able to connect at all as they are on some āolderā network?
Is there any documentation about how we can reach a specific instance with the external_port feature? I too am interested in setting up geo replicated databases.
Let us know what youāre thinking and where you get with geo replication! We have some features coming that should help with that, but weāre still trying to learn the best way to attach databases to apps that run all over.
@kurt My āmasterā database is actually going to be hosted on GCP because Iām using Cloud SQL. So what Iām thinking for my persistent data is to use badger, which is a simple key/value database. From here Iāll probably just set up a cron job to retrieve the data.
Rather than opening up another thread for this, can you tell me how persistent storage works and what kind of limits I might face? Iām deploying a ~20mb docker container so my starting point is pretty low. If you want me to open a new thread let me know.