Day 11 of building Kafka in Go until it breaks me :(
Today, I finally started working on BufferPools. I learned how Kafka handles buffer pools on the broker side and was shocked to see that it handles them dynamically instead of using a fixed size.
(1/3)
To avoid that V-shaped spike, I'm thinking of deleting buffers based on two parameters: 1st, max bytes allowed,if exceeded, the largest idle buffer gets cleared. 2nd, a time-based sweep every X seconds to drop buffers above my baseline (always keeping some to avoid warmup).
(3/3)
After researching it a bit, I learned that any 'V'-shaped traffic curve puts it under load. When traffic spikes, Kafka allocates buffers dynamically, when it slows down, JVM WeakReference clears them in the next GC cycle. Now I get why they chose this over SoftReference.
(2/3)
Here are some other interesting benchmarks of my broker.
Tested on Ryzen 7 6800H, 4800MHz DDR5 (~2GB/s page cache):
-Throughput flattens past 150KB at my 2GB/s page cache limit.
-Messages/sec drop as size grows (no batching).
-p99 latency spikes past 50KB from size overhead.
Finally started reading the Raft paper. I have worked with leader election and replication in the past with etcd (which uses Raft under the hood), so I will now be understanding how the states actually work, ig this many prerequisites would be enough.
Why does throughput decrease after 32KB? In Go, every CPU core has its own memory space (mcache) that no other can touch, no locks, whereas objects >32KB go to shared mheap, where multiple workers require locks. Next, I will bypass the garbage collector using fixed ring buffers
Day 10 of building Kafka in Go until it breaks me :(
Latest raw throughput benchmarks (no network),appending takes 0.85ΞΌs per record, so overhead drops as message size grows until 32KB, where exceeding Go's small object limit causes lock wait times and lowers throughput.
(1/2)
@vky5_ So will it be on NVIDIA GPUs only? Because Macs have non-CUDA GPUs. Also, I am particularly interested in latency since the laptops can be in different time zones, how would you ensure that the model spends more time computing rather than waiting
@Kangaskhan6@Jyotishman2u@infinterenders Agreed, and most computer scientists expect P β NP. I was just focusing more on P = NP (hypothetically) because thatβs where things get interesting.
@kritido4@Jyotishman2u@infinterenders I never said anything about kindness,even if I found the solution, Iβd never share it. I was just highlighting what happens if a solution exists in the first place.
@Jyotishman2u@infinterenders Youβre only right if the algorithm has massive complexity, like O(nΒΉβ°β°β°). Otherwise, it is literally a master key. For example every encrypted file, private key, and RSA system relies on the premise that solutions are hard to find. Proving P = NP means a shortcut exists
@ganeshreddyx Nothing personal, but software and mathematics are fields where I think you can't rest. You always have to learn, try out new things, and go deep into subjects.