Well that’s one way to do a load test

So, today my ActivityPub rant made the front page of Hacker News. I’m happy to say that as far as I can tell, Publ didn’t fall over at all, not even during the initial surge of activity (or at least, Apache never recorded any gateway failures or the like).

I mean, it isn’t too surprising, considering that pretty much any “hot” page or asset is going to live in an in-process cache and require basically no processing at all, but it’s still cool to see.

Page request graph over the last few months

For some technical details on the setup, here’s the current server configuration, which could definitely be improved:

  • Fronting server is just plain ol' Apache with Ubuntu’s standard configuration
  • Publ itself runs in an isolated Gunicorn instance launched as a systemd service
  • Apache is configured to reverse-proxy into Gunicorn’s port on this vhost
  • Caching is in-process to Publ (just using Flask-Caching’s SimpleCache backend)

This is actually kind of fragile; I’ve had situations in the past where gunicorn died for whatever reason and systemd wasn’t willing or able to restart it and I had to restart it on my own. This also means I have to manually manage my port allocations (so spinning up additional Flask-based websites is more trouble than it should be). At some point I intend to at least set it up as a UWSGI site, although that probably has performance implications. A better approach would be to switch to nginx, although that opens up a few cans of worms for some of my other stuff (like Reminder Me is still an old-school CGI, for example, and I think some of my static sites use .htaccess for a few things). Oh, and I should probably at least investigate memcached instead of using an in-process cache, if only because memcached provides better resource management and thread-safety.

And of course I’m not going to make any configuration changes during periods of site activity! (But at the same time none of this is critical enough for me to set up a separate staging environment beyond what I already get for free from Publ…)

On Publ itself I’m still looking at migrating away from peewee to something else. PonyORM is my current top candidate, since it has a great support community (including a very friendly core maintainer!) and its API is actually even more Pythonic than peewee’s.

This also got me to finally set up GoAccess although I need a more permanent setup for that. Also my vhost logging setup is kind of a mess right now, but analytics isn’t really a high priority for me beyond, “Hey, people are reading my stuff. Neat!”

Hey, people are reading my stuff. Neat!


Before commenting, please read the comment policy.

Avatars provided via Libravatar