I'm currently working on a server-side chess game to get a hang of Gleam, and I was wondering how to get around a possible bottleneck. The idea is that through HTTP requests a client can change the state of a chess game. The server can run multiple chess games simultaneously.
A client can create a new game by POSTing to /new, and then the a GameManager actor pushes a new Game to it's stack of games. Now if I understand correctly that's a hypothetical bottleneck, because if a lot of games get created at the same time, they all have to wait for this single GameManager actor to push to the stack. And then later on, if they POST a /move which moves a piece, we'd first have to go through the GameManager to request the current state of the game and then alter it, and push it again.
Is the Erlang ETS something that could solve this? Is there a gleam_ets package (couldn't find any)? Or are there other ways?
Btw I understand that with gleam_cowboy, every HTTP request is handled in a new process, is that true? If so, I guess you could stay in that process and request the game state through ETS and alter it, without going through a "bottleneck process"?
Quite new to Erlang/Gleam, sorry if something's obvious π