Weblog
Shared anonymous pages on Linux conflate two desirable types of sharing: aliasing memory within a process and aliasing memory between processes. Both of these types of sharing are useful, but it is not currently possible to choose only one or the the other on Linux today, AFAICT. Unfortunately, fixing this is hard.
µTune (OSDI 2018) presents a novel, adaptive threading model to minimize RPC latency regardless of current load in high-performance microservices. Traditional monolithic web applications have latency Service-level objectives (SLOs) in the range of 10s to 100s of milliseconds. Because responding to a user’s request in a microservice-based application may depend on many on sub-requests fanning out to dozens (or hundreds) of microservices, the latency budget for each internal request must be much shorter than that of the overall request, often on the order of single-digit milliseconds or less.
I’ve become super excited about Kubernetes and its model of declarative configurations backed by controllers. You tell Kubernetes what you want, and the system (hopefully) eventually converges to your desired state. The docs, including books like the excellent Kubernetes Up And Running, do a great job explaining how to specify things like Pods and Deployments, and giving a high level intuition for how their controllers work (are there enough running pods for this deployment? If not, start a new one).
The concept that has taken me the longest to get a grasp on has been Ingress controllers.
This has been a whirlwind year! I completed my final set of coursework towards my PhD and was admitted to PhD candidacy with distinction! Gwen and I celebrated our 1 year wedding anniversary, and had several other significant personal milestones. I presented several projects at regional and international academic conferences, and submitted my second publication on a super-cool new memory management technique. I interned on the Mobility and Networking team at Microsoft Research, and finally I am set to start as an Infrastructure Engineer at Stripe next week.
systemd is the init system used by the current versions of most major Linux distributions, including Debian, Red Hat, Ubuntu and Arch. One of its key features is reliable dependency management, building a dependency graph of services, and sequencing of services where unrelated services can be started in parallel, but dependencies are sequenced correctly.
Let’s walk through how systemd implements this. Of note - if you’re interested in what a modern C codebase that doesn’t care about backwards compatibility can look like, systemd is especially interesting.
This is a Syracuse-local recipe, scaled down from here. The goal is to match Cheeky Monkey’s sauce – I think we’re 80% of the way there but there is still some tweaking to do.
I recently finished Practical File System Design by Dominic Giampaolo - a great read on filesystem implementation. Some aspects of the book are dated (initially published in 1999), but it does (lightly) discuss multithreading issues, which are absent from much of the classic UNIX literature. The three topic covered I felt were especially notable are journaling, indexing, and the comparison with other filesystems.
This is about some fun I had while putting together a small Unix-y utility to measure RAM and swap usage - psm. I was able to decrease runtime by more than 65% during a 3-hour train ride with the help of some standard go tools.
Research
Mesh
Programs written in C/C++ can suffer from serious
memory fragmentation, leading to low utilization
of memory, degraded performance, and application
failure due to memory exhaustion. Mesh is a
plug-in replacement for malloc
that, for the
first time, eliminates fragmentation in unmodified
C/C++ applications. Mesh combines novel randomized
algorithms with widely-supported virtual memory
operations to provably reduce fragmentation,
breaking the classical Robson bounds with high
probability. Mesh generally matches the runtime
performance of state-of-the-art memory allocators
while reducing memory consumption; in particular,
it reduces the memory of consumption of Firefox by
16% and Redis by 39%.
Browsix
Programs written to run on conventional operating systems typically depend on OS abstractions like processes, pipes, signals, sockets, and a shared file system. Compiling programs into JavaScript, asm.js, or WebAssembly with tools like Emscripten or GopherJS isn't enough to successfully run many programs client-side, as browsers present a non-traditional runtime environment that lacks OS functionality. Porting these applications to the web currently requires extensive rewriting or paying to host significant portions of code in the cloud.
Browsix answers these challenges, with:
Processes: Unmodified C, C++, Go, and Node.js programs run as processes on Web Workers, executing in-parallel with the main browser thread – no need to worry about long-running computations blocking event-handling or page rendering.
Kernel + System Calls: By working at the lowest levels of abstraction, Browsix provides shared resources to multiple language runtimes, just as traditional operating systems enable running programs written in a host of languages.
Scalability: By enabling a large class of programs (including legacy codebases) to run in-browser, Browsix can free you from the chore of sandboxing and load-balancing programs server-side.
Projects
Web
HTTP sessions stored in encrypted cookies for Go
Reverse-engineered JavaScript API to the Acaia scale
Contributions
System Dynamics
System Dynamics is a methodology for debugging your mental models of the world. It does this by getting you to write down your assumptions as a model, simulate that model over time, compare the results to historical data, and project into the future. If the results based on your assumptions don't match the real data, you should consider changing your mental model! If the projection into the future doesn't look as you'd like, you are forced to be explicit with where and how your improved policies will influence the model. I wrote a thesis on object-oriented system dynamics as an approach to manage complexity and reuse models.
I'm slowly working on a web-based editor for SD models called Simlin, focused on simplicity and usability:
Go
I've authored a number of small changes, including a fix for a compiler crash. I found a nice little performance improvement in the time package. Previously, I've fixed issues in HTTP headers, JSON support, gob encoding, and the build system.
One Laptop Per Child
I was an intern and community member of OLPC. I diagnosed and fixed some bugs (like this one), worked on a System Dynamics activity named Model to enable students to do system dynamics modeling on the XOs, and rewrote the boot animation in C (from Python), cutting 12 seconds off the boot time for hundreds of thousands of laptops.