Joyful Bikeshedding
joyfulbikeshedding.com · Personal blog · on HN since 2018
Hongli Lai, a developer who writes about Ruby memory use, Linux tracing with eBPF, distributed locking, packaging and server monitoring.
What HN saysHN commenters cite it as an interesting, detailed resource, especially the Ruby memory bloat post, the eBPF explainer and the Google Cloud Storage locking algorithm.
20HN people shared it
7linked it in comments
33stories submitted
389story points
1 year agolast shared
2018people per year2026
Most-shared posts
- 1What causes Ruby memory bloat?5 people · 187 points · first shared 2019 · 70 comments on HN
- 2Full-system dynamic tracing on Linux using eBPF and bpftrace4 people · 141 points · first shared 2019 · 11 comments on HN
- 3The status of Ruby memory trimming and how you can help with testing (2019)3 people · 7 points · first shared 2019 · discussion on HN
- 4A robust distributed locking algorithm based on Google Cloud Storage3 people · 5 points · first shared 2021 · discussion on HN
- 5The Future of Traveling Ruby2 people · 3 points · first shared 2021 · discussion on HN
- 6Why Fullstaq Ruby? – Joyful Bikeshedding2 people · 3 points · first shared 2020 · discussion on HN
- 7How Debian Packaging Works1 people · 6 points · first shared 2020 · 2 comments on HN
- 8Studying the Kubernetes Ingress system1 people · 4 points · first shared 2018 · discussion on HN
- 9Why I avoid Prometheus+Grafana and choose Netdata for simple server monitoring1 people · 4 points · first shared 2018 · 2 comments on HN
- 10Should non-EU websites ban EU visitors under the GDPR?1 people · 4 points · first shared 2018 · discussion on HN
- 11Yes, team communication is supposed to be hard1 people · 3 points · first shared 2018 · discussion on HN
- 12Docker and the host filesystem owner matching problem1 people · 3 points · first shared 2021 · discussion on HN
- 13Why piping to 'cat' can stuck a CI job1 people · 3 points · first shared 2020 · discussion on HN
- 14Performance reviews considered harmful1 people · 2 points · first shared 2018 · discussion on HN
- 15In appreciation of Prometheus' engineering1 people · 2 points · first shared 2018 · discussion on HN
What HN people wrote when they linked it
FooBarWidget · 2023-05-12
I also wrote about distributed locking a while ago, particularly about implementing one on Google Cloud Storage. https://www.joyfulbikeshedding.com/blog/2021-05-19-robust-distributed-…
This is useful because cloud storage is very cheap and serverless. It certainly beats running a Redis or PostgreSQL instance.
In my research and implementation I took care of the problems described in this article (as well as the problems I encountered in other distributed lock implementations).
Clients either freezing or outright crashing or disappearing is definitely a major problem. So timeouts are a must. But you can't just have a timeout because you don't know whether a client is arbitrarily delayed or whether it has disappeared. Furthermore, some workloads have an unknown completion time so you can't pick any sensible timeout.
I address this by encouraging clients to behave as follows:
1. Make the timeout relatively short, but regularly refresh your lease to let others know that you're still alive.
2. Your lease may at any time be taken over by another client that thinks you've disappeared. So you must regularly check whether your lease on the lock is still valid. This checking must be done way, way before your timeout expires, in order to account for the possibility that you can be arbitarily delayed at any moment (GC pauses, scheduling pauses, network delays, etc). I recommend checking in an interval at most 1/8 of the timeout.…
docfort · 2023-01-11
It’s definitely surprising that macOS does this, but it makes me also wonder if the authors considered just modifying the binary so that the dynamic linker could find the library: https://www.joyfulbikeshedding.com/blog/2021-01-13-alternative-to-maco…
detaro · 2020-12-13
Not sure if this is jargon-free enough, but maybe it helps: https://www.joyfulbikeshedding.com/blog/2019-01-31-full-system-dynamic…
yxhuvud · 2020-11-16
One thing that has been known for a while is that there are allocation patterns where LibC malloc doesn't give back a sufficient amount of pages even when the pages are clean.
See for example https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-me… . In the end I think the consensus was that jemalloc was just better than invocing malloc_trim, but invoking malloc_trim now and then can certainly be a lot better than using neither malloc_trim or jemalloc.
themantri · 2020-11-06
https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-me… is a pretty interesting resource about this.
vthriller · 2019-04-17
> At this point jemalloc is so good
Some folks disagree:
> [Ruby's] memory usage only reduces when using jemalloc 3; memory usage is still high when using jemalloc 5. Nobody knows why, so that makes the choice of defaulting to jemalloc very dodgy.
via https://www.joyfulbikeshedding.com/blog/2019-03-29-the-status-of-ruby-…
masklinn · 2019-02-03
> Naturally I wanted to get my hands on this stuff to try it out for myself. Is it really as good as they say? Normally I stick to Linux, but it (generally) doesn’t have these Sun technologies.
Since then, bpftrace[0] has been released, supposedly it's actually better than dtrace, in the sense that it's even more capable[1].
See https://www.joyfulbikeshedding.com/blog/2019-01-31-full-system-dynamic… for a recent basic ebpf/bpftrace tutorial. Brendan Gregg also has a primer on eBPF: http://www.brendangregg.com/blog/2019-01-01/learn-ebpf-tracing.html
[0] http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html
[1] that's Brendan Gregg saying it: http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html — having contributed to it and being one of the leading dtrace experts