Live data from Hacker News

Java FFM zero-copy transport using io_uring

mvp.express

21–30 of 59 posts

Re: Java FFM zero-copy transport using io_uring

#21
post #15

Earlier quoted context omitted.

If the author doesn't understand their own code, I probably won't

Vibe coding doesnt mean the author doesnt understand their code. Its likely that they don't want carpal tunnel from typing out trivial code and hence offload that labor to a machine.

JNI for io_uring is not trivial code.

Re: Java FFM zero-copy transport using io_uring

#22
post #17

Earlier quoted context omitted.

For your pet project? No. For something you're building for others to use? Almost certainly yes.

You do realize that it's possible to ask AI to write code and then read the code yourself to ensure it's valid, right? I usually try to strip the pointless comments, but it's not the end of the world if people leave them in.

The comments aren’t the problem.

Re: Java FFM zero-copy transport using io_uring

#23
post #17

Earlier quoted context omitted.

For your pet project? No. For something you're building for others to use? Almost certainly yes.

You do realize that it's possible to ask AI to write code and then read the code yourself to ensure it's valid, right? I usually try to strip the pointless comments, but it's not the end of the world if people leave them in.

> I usually try to strip the pointless comments

You could add your own instead, explaining how things work?

> It's possible to ask AI to write code and then read the code yourself

Sure, but then it would not be vibecoding.

Re: Java FFM zero-copy transport using io_uring

#24
post #17

Earlier quoted context omitted.

For your pet project? No. For something you're building for others to use? Almost certainly yes.

You do realize that it's possible to ask AI to write code and then read the code yourself to ensure it's valid, right? I usually try to strip the pointless comments, but it's not the end of the world if people leave them in.

Yeah but you're leaving out a crucial part: the code is full of useless comments.

That leaves 2 options:

- they didn't read the code themselves to ensure it's valid

- they did read the code themselves but left the useless comments

No matter which happened it shows they're a bad developer and I don't want to run their code.

Re: Java FFM zero-copy transport using io_uring

#25
post #23
post #17

Earlier quoted context omitted.

You do realize that it's possible to ask AI to write code and then read the code yourself to ensure it's valid, right? I usually try to strip the pointless comments, but it's not the end of the world if people leave them in.

> I usually try to strip the pointless comments You could add your own instead, explaining how things work? > It's possible to ask AI to write code and then read the code yourself Sure, but then it would not be vibecoding.

>> It's possible to ask AI to write code and then read the code yourself

> Sure, but then it would not be vibecoding.

Wait, what?

Re: Java FFM zero-copy transport using io_uring

#26
post #8

27us roundtrip is not really state of the art for zero copy IPC, about 1us would be. What is causing this overhead?

indeed, you can get a packet from one box to another in 1-2us

with io_uring? How? I tried everything in the book

Re: Java FFM zero-copy transport using io_uring

#27
post #25
post #23

Earlier quoted context omitted.

> I usually try to strip the pointless comments You could add your own instead, explaining how things work? > It's possible to ask AI to write code and then read the code yourself Sure, but then it would not be vibecoding.

>> It's possible to ask AI to write code and then read the code yourself > Sure, but then it would not be vibecoding. Wait, what?

AI assisted coding/engineering becomes "vibe coding" when you decide to abdicate any understanding of what you are building, instead focusing only on the outcome

Re: Java FFM zero-copy transport using io_uring

#28
post #25
post #23

Earlier quoted context omitted.

> I usually try to strip the pointless comments You could add your own instead, explaining how things work? > It's possible to ask AI to write code and then read the code yourself Sure, but then it would not be vibecoding.

>> It's possible to ask AI to write code and then read the code yourself > Sure, but then it would not be vibecoding. Wait, what?

Vibe-coding as originally defined (by Karpathy?) implied not reading the code at all, just trying it and pasting back any error codes; repeat ad infinitum until it works or you give up.

Now the term has evolved into "using AI in coding" (usually with a hint of non rigor/casualness), but that's not what it originally meant.

Re: Java FFM zero-copy transport using io_uring

#29

27us roundtrip is not really state of the art for zero copy IPC, about 1us would be. What is causing this overhead?

Asking for those who, like me, haven't yet taken the time to find technical information on that webpage: What exactly does that roundtrip latency number measure (especially your 1us)? Does zero copy imply mapping pages between processes? Is there an async kernel component involved (like I would infer from "io_uring") or just two user space processes mapping pages?

27us and 1us are both an eternity and definitely not SOTA for IPC. The fastest possible way to do IPC is with a shared memory resident SPSC queue.

The actual (one-way cross-core) latency on modern CPUs varies by quite a lot [0], but a good rule of thumb is 100ns + 0.1ns per byte.

This measures the time for core A to write one or more cache lines to a shared memory region, and core B to read them. The latency is determined by the time it takes for the cache coherence protocol to transfer the cache lines between cores, which shows up as a number of L3 cache misses.

Interestingly, at the hardware level, in-process vs inter-process is irrelevant. What matters is the physical location of the cores which are communicating. This repo has some great visualizations and latency numbers for many different CPUs, as well as a benchmark you can run yourself:

[0] https://github.com/nviennot/core-to-core-latency

Re: Java FFM zero-copy transport using io_uring

#30
post #5

27us roundtrip is not really state of the art for zero copy IPC, about 1us would be. What is causing this overhead?

It may or may not be good, depending on a number of fact. I did read the original linux zerocopy papers from google for example, and at the time (when using tcp) the juice was worth the squeeze when payload was larger than than 10 kilobytes (or 20? Don’t remember right now and i’m on mobile). Also a common technique is batching, so you amortise the round-trip time (this used to be the cost of sendmmsg/recvmmsg) over,…

io_uring is a tool for maximizing throughput not minimizing latency. So the correct measure is transactions per millisecond not milliseconds per transaction.

Little’s Law applies when the task monopolizes the time of the worker. When it is alternating between IO and compute, it can be off by a factor of two or more. And when it’s only considering IO, things get more muddled still.

Post reply on HN