Should I Replace a Ring Buffer with a Lock-Free Queue in My Web Framework?
I have an experimental web framework I'm currently working on.
While going through the code to clean up styling before tagging a stable release, I've been debating this specific part in the HTTPS module:
https://github.com/c4punks/CWIST/blob/dev/src/net/http/https.c
Right now, this code just uses a dumb, massive ring buffer to absorb connection bursts, and I'm wondering if I should switch it to a lock-free queue.
There are three main things that make me hesitate:
* State can get pretty tangled and messy in a lock-free queue.
* We have a tiny team and I'm maintaining almost all of this alone. If something breaks with CAS (even if the odds are low, if I mess up the code during refactoring), the blast radius on the dev branch will just be too big.
* I also wonder how often real-world traffic actually warrants lock-free. Plenty of web frameworks handle traffic just fine without this level of extreme optimization.
Considering that I'm still a junior developer and lack experience, is it really worth swapping this out for a lock-free structure, and would it actually make a noticeable difference?