Unofficial Hacker News client - receive Push Notifications on replies.
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap
Share → Add to Home Screen, then open the installed app and enable push in Settings.
More of a meta comment, but I'm always grateful for these sort of network-related debugging blog posts. As a software eng who has a good grasp of networking at a conceptual layer, but has struggled to translate concept into concrete implementation in linux, I get a lot of value from these. Thank you to the author(s) for putting in the effort to write this up.
One of the wrongest default parameters in Linux is the dirty page ratio. By default, if I recall correctly, it permits up to 20% of pages to be dirty. If you're doing some quick arithmetic you already see the problem. The whole "pressure stall" concept has been adopted to hide this fact, when the better option is to simply lower the dirty page limit (not ratio) to 1GiB or less.
depends, if you have servers that buffer large blobs in tempfiles you don't really want those flushed to storage unless there's a real memory shortage.
No, on a multi-tenant machine I really, really want that tempfile thing to be throttled on dirty page creation. If that process thinks it can run in constant space without externalizing the page cache then it knows what to do: write its temporary objects to anonymous memory, not files.
The dirty ratio also behaves differently than I assumed at first. 20% does not mean 20% of all memory, it means 20% of "dirtyable" memory. Also, 1GB dirty threshold does not mean that writes only get slowed down at 1GB. There is a "freerun" threshold at the midpoint between the background dirty limit and the dirty limit, and the kernel starts progressively throttling writers at that midpoint.
The volume of the writeout in itself would not be a problem if it weren't that the dirty page table is locked until writeout completes. That means that new page allocations are stalled while writeout is in progress. And you're right, the default dirty page ratio is way too high, especially in the much-ram-meets-spinning-rust scenario. I have had rsync backups stall for over a minute while the archive server digests its dirty page buffer, only to have the server then stop writing for long enough to allow the disks to go back to standby mode.
It would take major engineering effort in the VFS layer to avoid locking the page table during writeout, but that's what a proper solution would look like in my eyes.
We should have a target rate test on prod to ensure we always hit that and assert in logs when it goes slow (in this case its memory throttle tomorrow is something else) as to ensure consistent performance for our apps
Replies (3)
Replies (2)
It would take major engineering effort in the VFS layer to avoid locking the page table during writeout, but that's what a proper solution would look like in my eyes.
> We launch nginx as a systemd service, and systemd places each service into its own cgroup and sets default controllers
Thank you for sharing.