Programming

Learning Rust 🔩 Design of a low-memory/high-speed HKP server

Started by pgpfreak · Dec 20, 2025

#11659
↳ Replying to @ace
Thanks man!
#11660
↳ Replying to @pgpfreak
I always thought you were one of the smart people on tforum. I mostly understand what you've done here. I'd have no hope of doing it myself.

You're on a whole other level.

Gratz on getting it to work, and thank you for sharing what you've done.
#11661
↳ Replying to @Beelzebub
Appreciate it man :) I don't think I'd have ever tried Rust if it wasn't for tforum. Turned out to be one of the nicest coding experience I had in a couple of years. Sounds only right that I share some of this goodness back with the community.
#11663
↳ Replying to @bludledder
Thanks! And yes, absolutely. I haven't wrote some in a while, but Rust feels like some kind of bonified C/C++. Syntax is somehow close to higher-level languages (you can do generics, delegates, use the "async" keyword and so on) only with a literal obsession for memory management. It's like you can't write a function call without explicit memory allocation one way or another. Not fun at first but once you catch the routine, it's mostly straightforward and makes for a bullet-proof defense against any kind of overflow exploit.
#11664
↳ Replying to @pgpfreak
You're a fucking legend. Damn, man, that's a cool fucking project.
#11665
↳ Replying to @Exael
Thanks man!
#11666
↳ Replying to @pgpfreak
Thanks for the post. Nice as always. Personally, I would've not gone the route of `RwLock` + `Arc` for the shared resource specially if perf is a concern due to lock contention. In Rust, message passing via channels (e.g., Actor model) between producers/consumers tends to be the way in my experience to go and will yield less headaches w.r.t. borrow checking, although that obviously requires a different architecture and data-flow.
#11667
↳ Replying to @marduk1776
Thanks for the feedback. Very interesting. I can absolutely foresee the kind of issue locks contention can create, but I chose to go with it anyway because my specific use case imply very, very few write accesses. It's read-only almost every time. Would you reckon the overhead of implementing a producer/consumer pattern to be worth it anyway in this scenario? Locks have the advantage of being kind of straightforward and it's obviously something I can appreciate as far as maintenance go.
#11668
↳ Replying to @pgpfreak
I'd say keep it as-is if the current system works for your needs and you do not expect the traffic to grow substantially. With few write accesses, the headache of a redesign is not worth it. P/C, as I'm sure you know, also has its own share of complexity and pitfalls.

Members-only continuation

This discussion contains more posts.

Create an account or sign in to continue reading the full conversation. 2 additional posts await inside.

Create an accountSign in