Update on Rust and this Blog's Performance
Subscribe with RSS
One of the goals I had when I wrote the blogging application this site runs on was performance. Yesterday, one of the posts was on the front page of hackernews for most of the day, and I have to say, I'm quite impressed on how well it did.
For context, this is currently running on the lowest tier DigitalOcean droplet - $5/month, 1 cpu core, 1 GB memory. Not particularly fast. I run no caching on the site - every request, the Rocket server will pull the markdown content from a sqlite3 database and render the (albeit very simple) template on demand. Images are served by nginx, which also reverse proxies requests.
Here you can you see the network graph
and the CPU graph
from DO's dashboard. That hackernews exposure is probably the most load I'd ever expect to have the site experience, and yet, while it's clearly noticeable, it was never even close to overwhelming it. Peak CPU usage on the entire system, including nginx, never punched above 10%. In fact, you can see some of the spikes from running backups induced more CPU load.
Now, serving a little over a page of mostly text is not exactly a difficult task, but it's quite common for random people's blogs to be hugged to death by slashdot (RIP), hackernews, digg, reddit, etc. I'm glad I was not particularly close to that fate.
And it does make me happy with my choice of language. Although I'm pretty sure Django or Flask or RoR could've handled this load as well given how low it was in the end, it definitely would've been closer, and I think a particularly bloated configuration of wordpress may have failed.
This isn't even the fastest Rust server - imagine how well warp, hyper, or actix-web would have chewed through things!