$ cat post/the-pager-went-off-/-i-typed-it-and-watched-it-burn-/-i-still-have-the-diff.md

the pager went off / I typed it and watched it burn / I still have the diff


Title: A January Blues: Weighing the New Year’s Tech Trends Against Real Work


January 2023 started with a flurry of tech trends and news that I found myself reflecting on. Amidst all the excitement around AI/LLM infrastructure and platform engineering, it felt like the pressure was building again. FinOps and cloud cost pressures loomed large, especially as we saw major companies like Google laying off thousands of employees.

I spent much of January dealing with a tricky issue that highlighted both the good and bad of modern tech stacks. It involved an unusual request from one of our teams: they needed to run a specific Python script in real-time on their server, but without having to manage a full-fledged Python environment. The solution seemed simple at first—use WebAssembly (WASM) to compile the script down to a binary that could run natively on the server.

The Experiment

I decided to give it a shot and started by setting up a WASM runtime in our Kubernetes cluster using a sidecar container approach. I chose Wasmer, an open-source WASM runtime, and configured it to load the Python script as a module. However, things quickly got hairy when I encountered memory management issues.

Python scripts rely heavily on dynamic memory allocation, which doesn’t play well with WASM’s sandboxed environment. Every time the script tried to allocate or deallocate memory, it hit a wall. It was like trying to fit a square peg into a round hole—neat in theory but messy in practice.

The Debugging Session

I spent days wrestling with this problem, hitting up forums and mailing lists for help. I even considered writing a small WASM wrapper that would handle memory management manually, but it seemed like an overly complex solution just to run one script.

Finally, after much trial and error, I found a workaround by using NanogPT as inspiration (yes, that NanoGPT you heard about in the Hacker News). It’s a tiny GPT model implemented in Rust, and its minimalistic approach provided me with a clue. Instead of trying to force Python into WASM, why not write a small script in Rust? It would be more lightweight and better suited for the constraints.

The Outcome

In the end, I wrote a simple Rust program that did exactly what was needed: read input from standard in, process it through a basic NLP model, and output the result. It worked like a charm and was much simpler to manage than trying to get Python to play nicely with WASM.

This experience highlighted some of the challenges we face as engineers today. We have these powerful technologies at our disposal, but they come with their own set of constraints that we need to work around. The goal is often not just to find a solution but to do so in a way that scales and works well within the existing ecosystem.

Reflections

As I sat back and looked at what I’d accomplished, I couldn’t help but think about how much the tech landscape has changed since 2015, when I first started working with Python. Back then, we didn’t have the luxury of WebAssembly or the variety of open-source tools available today.

But it also made me reflect on the importance of simplicity and practicality in engineering. Sometimes, the easiest solution is the best one—no matter how tempting it is to over-engineer something just because you can.

In 2023, I plan to continue focusing on these principles as I navigate the complex world of platform engineering and AI/ML infrastructure. It’s a challenging but rewarding path, and every day brings new opportunities to learn and grow.


That’s my take on January 2023. Looking forward to what the rest of the year will bring!