Earlier quoted context omitted.
You can't just tease us like that! I demand some details on everyone of the techniques in ;-) >Replace with huge-page mapped ring buffers, independent processes, kernel-bypass set-and-forget, buffer lap checks, file-mapped self-describing binary-formatted stats, direct-mode disk block writes, caller-provided memory Please elaborate.
Well, OK. All this is about high-throughput, low-latency systems. The principle is decouple, decouple, decouple. Memory isn't just memory, it's paged and mapped, and the mappings are in a small cache called the TLB, one for each core. Each "hugetlb" page, 2MB or 1GB on x86, takes just one such cache entry, so anything big, like buffers, should live in hugepages. A ring buffer is a kind of queue with just a head, and…
Ask HN: What are some architectural decisions that improved your codebase?
61–70 of 78 posts
Re: Ask HN: What are some architectural decisions that improved your codebase?
#62You can start an entire business in consulting on test automation and you would never run out of work.
Re: Ask HN: What are some architectural decisions that improved your codebase?
#63Earlier quoted context omitted.
> Stateless components, or as I like to call them dumb components. You mean like pure functions? https://en.m.wikipedia.org/wiki/Pure_function
Yes similar, I'm talking about reactive UI components though (used in React, Vue, Angular etc.). They're a class that might have many functions. In this case all the component's functions would be pure functions though. Perhaps a better term could be pure components maybe?
Re: Ask HN: What are some architectural decisions that improved your codebase?
#64Earlier quoted context omitted.
Well, OK. All this is about high-throughput, low-latency systems. The principle is decouple, decouple, decouple. Memory isn't just memory, it's paged and mapped, and the mappings are in a small cache called the TLB, one for each core. Each "hugetlb" page, 2MB or 1GB on x86, takes just one such cache entry, so anything big, like buffers, should live in hugepages. A ring buffer is a kind of queue with just a head, and…
This is all fascinating. Do you have any recommended reading on designing said high-throughput, low-latency systems?
Re: Ask HN: What are some architectural decisions that improved your codebase?
#65Don’t use Kubernetes or Microservices. Solves most problems. Not even being sarcastic.
Re: Ask HN: What are some architectural decisions that improved your codebase?
#66Choose Boring Technology http://boringtechnology.club/
Build your system to be level-triggered as much as possible. Its default mode should be reconciliation: examining its current state and transforming that into the desired state, especially if the current state is "something went wrong". Build in dumb reconciliation before worrying about making it more real-time.
The fewer moving parts, the better. Don't go multi-service architecture until you absolutely have to (see YAGNI, KISS).
Keep your business logic contained, separated from everything else, in ONE place. If I open up your business logic code, I shouldn't see anything about persistence, the network, etc. Similarly, I shouldn't find any business logic in your other concerns. The business logic interacts with other concerns via abstractions.
Be unforgiving when it comes to correctness guarantees. Use the type system as much as possible to make errors impossible.
Re: Ask HN: What are some architectural decisions that improved your codebase?
#67A few examples here.[2]
1. https://drewdevault.com/2019/02/25/Using-git-with-discipline...
2. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
Re: Ask HN: What are some architectural decisions that improved your codebase?
#68Earlier quoted context omitted.
You can't just tease us like that! I demand some details on everyone of the techniques in ;-) >Replace with huge-page mapped ring buffers, independent processes, kernel-bypass set-and-forget, buffer lap checks, file-mapped self-describing binary-formatted stats, direct-mode disk block writes, caller-provided memory Please elaborate.
Well, OK. All this is about high-throughput, low-latency systems. The principle is decouple, decouple, decouple. Memory isn't just memory, it's paged and mapped, and the mappings are in a small cache called the TLB, one for each core. Each "hugetlb" page, 2MB or 1GB on x86, takes just one such cache entry, so anything big, like buffers, should live in hugepages. A ring buffer is a kind of queue with just a head, and…
I have had opportunity to work on/with some of these techniques on Fast Network Protocol/Security Appliances and so have some familiarity with them. However some of your hints(breadcrumbs?) are not known to me and hence i have something to research and study. Thank you.
PS: Can you add some more details on the above techniques? Like System/Library/API calls to look into, books/papers/articles to read etc?
Re: Ask HN: What are some architectural decisions that improved your codebase?
#69Earlier quoted context omitted.
Well, OK. All this is about high-throughput, low-latency systems. The principle is decouple, decouple, decouple. Memory isn't just memory, it's paged and mapped, and the mappings are in a small cache called the TLB, one for each core. Each "hugetlb" page, 2MB or 1GB on x86, takes just one such cache entry, so anything big, like buffers, should live in hugepages. A ring buffer is a kind of queue with just a head, and…
This is all fascinating. Do you have any recommended reading on designing said high-throughput, low-latency systems?
* Network Algorithmics,: An Interdisciplinary Approach to Designing Fast Networked Devices - https://www.amazon.com/Network-Algorithmics-Interdisciplinar...
* See MIPS Run - https://www.amazon.com/Morgan-Kaufmann-Computer-Architecture...
* UNIX Systems for Modern Architectures: Symmetric Multiprocessing and Caching for Kernel Programmers - https://www.amazon.com/UNIX-Systems-Modern-Architectures-Mul...
* Advanced UNIX Programming - https://www.amazon.com/Advanced-UNIX-Programming-Marc-Rochki...
Re: Ask HN: What are some architectural decisions that improved your codebase?
#70Earlier quoted context omitted.
Well, OK. All this is about high-throughput, low-latency systems. The principle is decouple, decouple, decouple. Memory isn't just memory, it's paged and mapped, and the mappings are in a small cache called the TLB, one for each core. Each "hugetlb" page, 2MB or 1GB on x86, takes just one such cache entry, so anything big, like buffers, should live in hugepages. A ring buffer is a kind of queue with just a head, and…
This is great! These are some concrete and non-trivial architectural techniques for "Systems Programming" :-) I have had opportunity to work on/with some of these techniques on Fast Network Protocol/Security Appliances and so have some familiarity with them. However some of your hints(breadcrumbs?) are not known to me and hence i have something to research and study. Thank you. PS: Can you add some more details on th…
Speaking of breadcrumbs, if the ring buffer has fixed-size entries, a reader can come in later and start reading old entries first, say halfway back. This is helpful if you want to start a new reader and then kill an old one, and not skip any entries.
It helps if the ring has power-of-two size, and the head pointer/index is 64 bits and increases monotonically. Then the high bits are easily masked off on each use, so that arithmetic on pairs of positions is simpler.
For variable-sized entries, an array of N "breadcrumbs", past positions near 1/Nth indices, allows jumping in at earlier positions. If traffic is low enough, you might be able to buffer a whole day's traffic, and get random access starting from breadcrumbs; otherwise, you can log old entries to a sequential file, and also log the breadcrumbs, translated to file offsets, as a global index.
Downstream processes can each sequentially log an individual field of each record, with a breadcrumb index to enable full records to be reconstructed. Often these column logs can be compressed, with enormous efficiency, between breadcrumbs: 98% compression may be easy to achieve for slowly-changing or limited-alphabet values.
Lz4 and Zstd are excellent compression engines. Lz4 really shines for fast decompression. There is no excuse for zlib/gz compression anymore.