6 ms·
Basic proxy implementation using io_uring
- CoolCold 3y agowould be interesting to see some performance benchmarks - I do care on TCP streams mostly for now, cases I do cover by HAproxy/Nginx in the systems.
- bjconlan 3y agoI really need to get my head across some of these things. I've been meaning to also look into https://www.kernel.org/doc/html/latest/networking/tproxy.html https://www.kernel.org/doc/html/latest/networking/tproxy.htm... (in regards to udp(quic)/ztunnel-esque behaviour). This will serve as a great reference, thanks.
- 38 3y ago> basic 1300 lines... also, the line numbers dont actually align with the lines: https://git.kernel.dk/cgit/liburing/tree/examples/proxy.c#n1303 https://git.kernel.dk/cgit/liburing/tree/examples/proxy.c#n1...
- o11c 3y agoFWIW it's about 800 lines excluding comments. and yeah, this is why you don't abuse side-by-side divs ... actually, that's a table ... and instead just make your number unselectable (there are several ways to do this).
- packetlost 3y agoThat's pretty small for a complete C application...
- userbinator 3y ago[flagged]
- deleted 3y ago[deleted]
- rogers12 3y agoYou should go back and add error handling to your C programs
- userbinator 3y agoAre you implying I don't already have error handling? Personal insults are not acceptable here.
- verticalscaler 3y agoMy dude, how would he know better? It is a perfectly fair assumption given the average C code base. Those numbers are unusually succinct. You sound like you really know what you're doing, if you can, please share some of this for our edification and don't take things personally.
- znpy 3y ago> Are you implying I don't already have error handling? With baseless claims, no code, no other consideration? I would not imply that, I would assume that.
- lionkor 3y agopost your code
- littlestymaar 3y agoHow is a codec a complete application?
- unmole 3y agoTalk is cheap, show me the code.
- znpy 3y ago
- jeroenhd 3y agoIt aligns perfectly for me. Must've been mostly tested on Firefox.
- rwiggins 3y agoThere's something super weird going on with those line numbers. They don't align for me either (Firefox on Windows 11). In the web inspector, the line numbers are rendering with Courier New as the font, whereas the code itself is `monospace`. The weird thing is both are controlled by a single CSS rule, div#cgit pre { font-family: "Source Code Pro", "Courier New", monospace; } (Changing to just `monospace` fixes it.) I'm not sure how two elements could have different fonts with that. I'm possibly missing something obscure, but it really feels like a browser bug.
- hddqsb 3y agoGreat sleuthing, the missing piece of the puzzle is that the file contents are inside a <code> element while the line numbers are not, and <code> elements have a default font so they don't inherit the font from their parent element. Changing the selector to the following fixes the issue: div#cgit pre, div#cgit code { ... } (The buggy CSS is not present in the the official cgit repository, so I assume the owner of kernel.dk is running a patched version of cgit.)
- lukeh 3y agoio_uring is wonderful.
- topspin 3y agoio_uring has produced many security problems. Google has found it necessary to either completely forego io_uring or severely limit its use to trusted code[1]. This policy includes Chrome OS, Android and Google Cloud. Docker has also blocked io_uring syscalls (by default) from being called by containers for the same reason and, although they've flip flopped on this at least once, I believe io_uring is currently blocked. This is highly disappointing to me, but also not surprising given the nature of io_uring. Solving it will require more design rigor, probably some performance compromises and possibly some degree of formal validation. [1] https://www.phoronix.com/news/Google-Restricting-IO_uring https://www.phoronix.com/news/Google-Restricting-IO_uring
- hinkley 3y ago“Faster than possible” is a phrase I picked up an awfully long time ago. I hope someone finds a reasonable middle ground that’s still several times faster but not Swiss cheese.
- adrian_b 3y agoThe security problems for io_uring or for any other system calls exist only when an adversary has access to those system calls. Whenever you write an application for internal use, where there is no possibility for an adversary to interfere and control in any way the arguments of the system calls, there is no reason to avoid io_uring or other risky system calls.
- littlestymaar 3y agoDefense in depth through sanboxing is there to make sure that even an attacker that get some amount of undue privilege will not be able to do harm. At this point we've learned that all existing systems will have vulnerabilities of some sort, so defense in depth is the only credible security posture.
- SPascareli13 3y agoSo, is io_uring used anywhere yet?
- dankebitte 3y agoAnything using glommio [1]. [1] https://crates.io/crates/glommio/reverse_dependencies https://crates.io/crates/glommio/reverse_dependencies
- i_am_a_peasant 3y agoI used it for some high datarate record applications at work. Does the job nicely without even half the boilerplate of aio if you use liburing.
- sbstp 3y agoI think there's still a lot of concerns related to security https://www.phoronix.com/news/Google-Restricting-IO_uring https://www.phoronix.com/news/Google-Restricting-IO_uring
- SPascareli13 3y agoWere any of this vulnerabilities disclosed? I saw that Google blocked it in some places, but without fully understanding what are these vulnerabilities it's hard to make a good judgement on whether it is usable or not in some application.
- jandrewrogers 3y agoThere are practical backward compatibility and security issues currently that prevent widespread deployment. I’ve been leaning into io_uring going forward because it is clearly the future and brings a lot to the table. It still can’t be used in many environments but I expect it to be mainstream in 2-3 years. Niche, but not for much longer. Most software doesn’t properly use the old io_submit facility and that has been around for decades, despite the large performance improvements possible. Even when io_uring is widely deployable, most software won’t use it.
- 3y ago
- gigatexal 3y agoCome on HN. Do better. Silly conversations about the number of lines? How about any C experts and networking pros weigh in on this? Has anyone built it and tested it?