-
Notifications
You must be signed in to change notification settings - Fork 393
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
Rework threading model #7778
Rework threading model #7778
Conversation
cool, this looks closer to what we need |
I cleaned up
Which is the exact same as:
So we can cut out around half of the work for that, which is nice. |
I changed the lobby sub timeout from 6 hours to 1 hour, and made it so they actually get pruned (I missed a case before), and also get periodically cleaned up (currently every 5 or so minutes). |
right now it all seems to be working on playtest, so I'm going to mark this as ready for review |
just realized I made a really dumb mistake. I'll commit a few more times in a minute. |
ok so it turns out I was passing in the executed function bodies to the thread pools, so they weren't really doing anything at all 😂. I converted them to macros (this took an embarrassing amount of time to figure out), and they appear to function correctly now, so we should actually be load balancing stuff. I also made it so if for some reason we try to execute an op on a nil lobby, and the function doesn't already check for it, we execute that on the lobby thread rather than a non-existent thread from the non-existent lobby. |
i say go for it. can't get much worse |
This turned out to be 200% easier than I thought it would be.
We're supposedly not meant to use virtual threads for anything that touches atoms, because atoms do funny concurrency things already, so we're still using claypoole's thread pools. But now we're keeping a fixed set of pools (cores+2), and assigning each lobby a pool at random from the least occupied pools. The only thing that really changes (we have to track) is just an integer for each pool. Other than that, this literally plugs 1:1 into the other code I wrote, which is neat.
I also enabled theProbably best to trial that later, instead of doing too much at once.simple-auto-threading?
option on sente's socket server, which I'll try out on playtest, but that might be overkill.I'm going to sample it on playtest over the next week or two and see if it causes any issues or is noticable at all.
Summary of changes: