BREAKING NEWS
The Norwegian Nobel Committee has decided to award the 2025 #NobelPeacePrize to Maria Corina Machado for her tireless work promoting democratic rights for the people of Venezuela and for her struggle to achieve a just and peaceful transition from dictatorship to democracy.
#NobelPrize
What a milestone! We are happy and proud to announce the Apache Kafka 4.0.0 release!
It’s the first release without Zookeeper, and so many other core improvements like the new consumer group rebalance protocol (GA) and Queues for Kafka (EA) to just mention a few…
\1
CVE-2024-3094 concerning a backdoor exploit in XZ Utils 5.6.0 and 5.6.1 releases are currently being analyzed, for the moment we have paused Archive processing. We will advise as soon as possible. For more reading and information:… https://t.co/nXQKwb0I31 #debian
When Java became popular, people (me included) claimed that it was massively better than C/C++. This was highly controversial and people mocked me for using Java. I was hammered by the referees during my first grant application for picking Java as my language of choice.
In some ways, Java is great..
We have lots of big data software written in Java and Java-like language... Lucene, Elastic Search, and so forth.
It is not at all obvious that you could just rewrite them in C and make them faster.
You can, but it requires skill. If you task Joe the intern into rewriting your Java code into C, the result will almost assuredly by buggier and slower code.
But the same thing happens in reverse... You can write code in Java that will give the average C/C++ system a run for its money. We have an implementation of Roaring Bitmaps in Java, and one in C. When I last benchmarked them, the Java implementation was sometimes faster... Of course, it means that the C version could and maybe should be further optimized... but it is surprisingly easy to write fast code in a higher level language...
My own view is that, most of the time, you can write fast and effective software in just about any programming language.
What is more important is the social component. Some programming languages attract some people and some problem areas. The Go people are not like the C# people.
And the social differences are more important in practice.
In some sense, if you are offered a job, and they tell you "we code in C#", they tell you a lot. It is not about the syntax or the tools primarily. It tells you what kind of philosophy they have.
Ultimately, all languages s*ck. They all have annoying limitations and you eventually hit them. There is no free lunch.
So innovation good, hobbyists and hacker culture bad - unless it happens upsptream. Got it.
Seems within your right to do this, but own it.
Adding insult to injury was unnecessary.
We will always send our code upstream and abide by the open source licenses our products use, which includes the GPL. Red Hat's Mike McGrath expands upon the recent CentOS Stream changes: https://t.co/JlQupGVWeU.
Zero copies.
One copy.
Two copies…
Which one is better?
Zero, of course.
Zero-copy is an optimization that has to do with how we copy data in the OS.
The problem is simple:
Many applications, Kafka included, have the job of basically:
🔸1. reading files from the disk
🔸2. serving that data over the network as a response.
When we get into the internals of it all, we see that the actual bytes get copied a bunch of times:
1. disk → OS read buffer
2. OS read buffer → application buffer
3. application buffer → socket buffer
4. socket buffer → NIC buffer
Four copies!
That being said, some of these copies are more efficient than others because they use the DMA engine.
DMA stands for Direct Memory Access.
It’s a feature in computers memory controllers which allows certain hardware (sound cards, graphics cards, network cards, etc.) to access the memory (RAM) without the CPU’s involvement.
Additionally, we have a bunch of user <->kernel mode switches which aren’t free either:
1. user -> kernel mode
2. kernel -> user mode
3. user -> kernel mode
4. kernel -> user mode after response is written out
So in total - 4 context switches and 4 copies of the data.
Do we need all of this?
💡 Step 1: Disk -> OS Read Buffer.
The OS read buffer may seem unnecessary here - we could just copy directly into the application.
In a single isolated operation, the OS read buffer does not make sense - but throughout the continuous functioning of the system it shines.
Why?
Caching.
Readahead caching is when the OS caches more parts of a file that you actually wanted to read.
This is why linear reads on HDDs can be so efficient - the OS typically reads more than requested amount, and the rest is left in the cache. On the next read, you read from memory and not the disk, resulting in a big performance gain.
🤖 Translated into Kafka - the next fetch request will directly hit the cache and avoid accessing the disk.
So let's keep that buffer. 🤝
As for the first context switch associated with it, it is fundamentally unavoidable. We will always need to go to kernel mode to read from the disk.
💡 Step 2: OS Read Buffer -> Application Buffer.
If your application is not doing anything with the data, why do we need to copy the bytes there?
Exactly. We don’t. This is what zero-copy is.
Kafka stores its data in the same binary format it responds to requests with.
Zero-copy, misleadingly named, is the act of NOT copying data back to the application but rather directly copying it into the NIC buffer.
This avoids copies 2) and 3), and avoids the two context switches associated with them!
This is a very efficient optimization, especially when you're reading more than what the OS read buffer can take.
🙈Imagine the worst case we had - reading multiples of what the disk read cache can store.
This meant that:
💥1. the extra cached copy in the OS read buffer wouldn't get used on further reads (entirely useless copy)
💥2. we had to do steps 1) and 2) in a loop until the wohle data is read by the application.
The new flow, thanks in part to scatter-gather operations, is such that:
1. the DMA engine reads from disk into the OS read buffer.
2. the CPU copies very small amounts - file descriptors (references) into the OS socket buffer.
3. scatter-gather operations have the DMA engine use the socket buffer references to read directly from the OS read buffer into the NIC buffer.
Misleadingly named - it's not quite *zero* copies, but it's much less than we started with!
Four context switches and four copies down to just two of each!
It's a great optimization that has been benchmarked to be up to 65% more efficient in certain cases.
I am not certain of its exact efficiency gains in Kafka in particular, as it depends a lot on the application that's being benchmarked.
anyway. 👑 Gelje Sherpa!!! 👑 May you have a great rest-of-your life and may your name and deeds echo eternal through Valhalla 🫡
> "Saving one life is more important than praying at the monastery," said Gelje, a devout Buddhist.
https://t.co/LbbnUrOS4o
Si como dijo el CEO de @aaw2000oficial ""Bariloche es la plaza que más creció este año" 07/22, entonces porque ni tiene aire acondicionado? Hizo 28, 30 grados. Es un horno y ponen ventiladores?
@moises_silva It is as old as time... taking a real issue into an absolute extreme. It's a dead dogs don't bite mentality. The complete lack of nuance baffles me.