How fast can an HTTP server in Node run if we spawn a process for every request? import{spawn}from"node:child_process";importhttpfrom"node:http";http.createServer((req,res)=>spawn("echo",["hi"]).stdout.pipe(res)).listen(8001); You should avoid spawning a new process for every HTTP request if at all possible. Creating a new process or thread is expensive and could easily become your core bottleneck. At Val Town there are many request types where we spawn a new process to handle the request. Wh...| Posts on Max McDonnell
About a year and a half ago I decided to start working on a build system inspired by Nix called Bramble. Andrew Chambers had launched hermes and I was messing around with starlark-go a bit and it seemed like writing a Nix-inspired functional build system with Starlark would be a nice way to better understand how they work. Bramble is no longer a test project, and has matured into something that I think has a few interesting ideas worth sharing.| Posts on Max McDonnell
I’m currently writing a toy Nix/Guix called Bramble to learn more about the inner workings of both systems. One of the features that I wanted to include in my version was “binary relocation”. Both Nix and Guix have hardcoded store paths that are baked into all the outputs that they produce. If we take a look at part of a simple nix Derivation you’ll see that these paths are hardcoded directly in the file. This is an important component of Nix. Instead of searching for the default shar...| Posts on Max McDonnell
tl:dr star is a python(ish) programming environment that lets you call Go library functions. click down to the repl if you’d just like to play around Starlark is Google’s custom subset of Python that it uses as a configuration language with Bazel. I started looking into it a little because it has some interesting characteristics. It’s not turing complete (no unbounded loops), it doesn’t have classes or higher level abstractions, it’s also deterministic and is somewhat safe to run un...| Max McDonnell
HTTP1 is simple and easy. With enough care you can open a TCP connection and hand-write an HTTP request to a server and get a response. Good fun. HTTP2 is more complex. Multiple bidirectional requests can be multiplexed over a single connection. You might use it with something like GRPC, or to get web pages to load faster. HTTP3 is wild stuff. Implemented over UDP instead of TCP. You can open a connection, open streams on that connection, send data with different types of ordering and deliver...| Max McDonnell
Let’s go on a winding debugging adventure together. I thought I could get a Go HTTP handler running on Val Town and I thought it would be easy. Val Town is a social website to write and deploy Typescipt. Val Town doesn’t support Go, but it supports WASM. Can we make it all work!? If you want to skip all this and just run Go on Val Town you can follow the instructions here.| maxmcd.com