I’m very, very tired of planning and spreadsheets and slide decks (and even more tired of all the insanity around the pandemic), so I spent a couple of hours this weekend geeking out a bit. Nothing of consequence, just some harmless fun.
Spurred somewhat by Rachel’s post I spent a couple of hours fiddling with low-level Python HTTP servers and found
bjoern, which can zip out well over 30K “Hello World” requests per second measured from my i7 hammering a toy server on a Raspberry Pi 4 (and an order of magnitude above running locally on the i7).
Comparing runtimes, workloads and RPC vs HTTP is pretty useless (anything is going to be faster than Python at raw socket wrangling), but it is interesting to see the low-level behavior (it’s not about your runtime, it’s about how it (ab)uses the stack and the threading model you use) and compare it to the new batch of
asyncio frameworks out there, especially because
libev and is (nominally) single-threaded, which makes it a lot easier to build “microservice” wrappers for existing code.
For more generic things, though, it’s not all there yet. It lacks a router (fortunately you can use Bottle on top of it), and it’s not as effective as
uWSGI for my current use cases.
I tried moving this site to it for half an hour and it worked quite well with two concurrent processes (thanks to the marvels of
SO_REUSE_ADDR), but it was a little slower overall–I strongly suspect
uWSGI has a significant edge in this scenario solely because it talks to
nginx via a domain socket, and I didn’t have the time to try that out yet.
Since I recently updated my Python base images, I briefly toyed with the notion of setting up a test harness for this kind of thing, but
wrk is still a bit buggy regarding reporting socket errors (
siege has other issues, too) and time isn’t on my side.
I miss Clojure but every time I try to go back it takes me forever to get a working environment going (not just in terms of tooling, which is straightforward, but also in terms of iterating through code and JVM startup times), so I’ve been looking at alternatives, and Janet seems to cover most of my needs–LISP syntax, a straightforward web framework (Joy), and support for the basics (JSON, SQLite, etc.)
It’s a bit daft at serving HTTP requests (it uses
mongoose, which doesn’t do the best socket handling by default) but can manage ~3K requests per second on a Pi 4 (again measured from an i7 over gigabit), but it’s really easy on the eye, and easy to write.
The only real issue I see is a lack of libraries.
xpath would be great, for starters, and it lacks all the nice Clojure-like builtins Joker ships with… So I’m not sure I’ll keep using it, although I am certainly impressed with how nice it is.
Traefik has been my go-to ingress controller for Kubernetes deployments of all sizes, but I still haven’t gotten enough bench time with
v2 (every time I try I end up reverting to 1.7 for some reason), so I’m trying to put together a test rig/default setup using nothing but
docker-compose, spit and a lot of cursing.
This has been going on in the background for a bit (sort of like waging guerrilla warfare in the evenings), and in the process I “fixed” having decent hostnames on my LAN by cleaning up
avahi-aliases and am currently trying to get Authelia to play along nicely.
This because one of the things I miss (and that I really need for a few personal projects) is having a reverse proxy with proper SSO/identity management. Even though Authelia doesn’t do social authentication (yet), it seems like something worth adding to my toolbox.
You know, in case I actually get back to full-time engineering some day. One can only hope.