Comment by 🚀 stack

Re: "DIY Gemini Servers..."
In: u/stack

@ingrix, I finally had a chance to look at libpxd a bit, and it's pretty close to my original thinking.

I've been trying to come up with a minimal solution for adding server capability to a minimal game and trying out some tests...

I would love to keep it down to a single process to avoid synchronization issues, and keep all data in RAM. This rules out CGI. To keep slow connections from DOSing the game, there are two options: traditional non-blocking events and NBIO via KTLS, which is pretty new but should work.

libpxd appears to be non-blocking, and I put together a simpler version of it as well. However KTLS seems like the way to go if I can get it to work.

It would avoid all the clumsiness with WANT_READ/WANT_WRITE stuff. Also move a lot of stuff into the kernel and avoid some copying, hopefully making the thing more lightweight.

I will try to slap together a proof-of-concept to see if it works.

Unfortunately it looks like I will have to recompile OpenSSL to enable it as stock Ubuntu one seems to not have enable-ktls...

🚀 stack [OP]

Sep 09 · 3 months ago

3 Later Comments ↓

🚀 stack [OP] · Sep 10 at 13:48:

KTLS/async in kernel is not really an option.

I thought it would be -- it's been around like a couple of years! But on my AWS Ubuntu 24.04 instance, OpenSSL is compile without ktls, and the kernel is not configured to do kTLS.

Took me half a day to figure it out -- after a ton of looking around headers and kernel modules I even recompiled OpenSSL with ktls only to find out it did not actually compile because the kernels is stubbed -- reporting that it does support ktls but actually doing nothing. Why? I don't know.

So back to non-blocking sockets and old event loop.

🚀 ingrix · Sep 10 at 15:24:

@stack darn, that's a shame. I had read about KTLS a while back and forgot about it. If you had gotten it to work that would have been awesome. I guess good luck with the old-fashioned method in the meantime though, I'm happy to bounce ideas around with you if you need, too.

🚀 stack [OP] · Sep 10 at 15:53:

@ingrix -- thanks, I may bother you with some questions. And your code is pretty good too.

I think I could probably get ktls to work on my dev box, but with all the hosting issues it's probably better to wait till it's more mainstreamed.

Original Post

🚀 stack

DIY Gemini Servers... — I am kind of tired of bending over backwards to code CGI games running behind a server built for an entirely different purpose. I am just going to write my own. This is easier than what I am doing now, opening and closing users and game state databases and loading the same stupid files for every click. The game logic is really, really fast with the game pre-loaded. User data is likewise in RAM. The only variable is the network. I could write a simple async server...

💬 11 comments · 2 likes · Sep 04 · 3 months ago