Weekly notes #2

Ruby, systems, performance, and programming links from last week.

Been trying to dig into (e)BPF a bit more, so few of the links are related to it.

Articles

BPF

BPF, the forgotten bytecode. Explains how BPF byte code works, it’s restrictions, how tcpdump sets up the socket to attach the bpf filter. CloudFlare uses xt_bpf iptables module (included in the mainline kernel - at least v4.9 has it) that allows filtering based on bpf bytecode:

  iptables -A INPUT \
       -p udp --dport 53 \
       -m bpf --bytecode "14,0 0 0 20,177 0 0 0,12 0 0 0,7 0 0 0,64 0 0 0,21 0 7 124090465,64 0 0 4,21 0 5 1836084325,64 0 0 8,21 0 3 56848237,80 0 0 12,21 0 1 0,6 0 0 1,6 0 0 0," \
       -j DROP

eBPF Trace from Kernel to Userspace A presentation from SUSE kernel labs team.

Ruby

How to update a single gem with bundler Should’ve learned this years ago, instead of blindly running bundle update gem_name. TL&DR: bundle update --source gem_name.

Adventures in Production Rails Debugging - from Shopify’s Scott Francis. Explains how he used GDB to get a core dump (generate-core-file in GDB) and analyze it to debug a query parsing issue in rack. Introduces a super-useful script to be run in GDB that grabs a Ruby backtrace. Julia Evans’ post How to spy on a Ruby program does a nice job explaining how the script works, i.e. how to get from the ruby_current_thread pointer to the iseq.location struct in the MRI VM.

Rom 3.0 was released.

Random

Choosing the "best software". Julia also wrote about her software selection criteria. Maybe I’d add: “Pick software that is human-centered, i.e. one with the best design, and human operators in mind” as one possibly related to ‘pick one which people like’. Some software seems to be really useful, but is awful to use/operate. There are also other criteria related to maybe the future of the project and stability and governance? But YMMV on this one.

Radix-sorting floats I thought Radix sort only works for integers. Ha, wrong! The article shows a conversion between floats and integers that preserves ordering. Convert, radix-sort, convert back. Cool!

7 Years of YouTube Scalability Lessons in 30┬áMinutes Yay! Really excited to see how pragmatism and hard work to improve an (already good) tool stack (Python, MySQL) can bring the platform that far (instead of hot-swapping the next-big-thing into production at the first sign of “performance” issues). Similar in spirit to Service discovery at Stripe post, about gradually adopting and improving Consul.

YouTube Strategy: Adding Jitter isn't a┬áBug Adding jitter to de-synchronize processes and avoid ‘thundering herd’ effect.

The Synchronization of Periodic Routing Messages - There’s a paper on how synchronization phenomena emerge in computer networks. It models and studies protocols sending periodic messages (uses Markov chain model), where messages create a weak coupling via send timers dependent on message arrival. The emergence of synchronicity is spontaneous, not gradual, there’s a sharp threshold dependent on the number of nodes (for fixed jitter) and jitter size (for fixed # of nodes), above which the effect appears/disappears.

The Full Stack, Part I - On estimating capacity and performance characteristics (back-of-the envelope style) from shape of data, patterns of read/write operations and consistency, latency, contention and locality requirements.

My Go Resolutions for 2017 Russ Cox writes about long term plans for Go.

Tools

gopass - command line password manager, compatible with pass.

Automatically Lock Old Closed GitHub Issues Useful for OSS maintainers.