<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: firecracker</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/firecracker.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2024-12-06T17:12:10+00:00</updated><author><name>Simon Willison</name></author><entry><title>DSQL Vignette: Reads and Compute</title><link href="https://simonwillison.net/2024/Dec/6/dsql-vignette-reads-and-compute/#atom-tag" rel="alternate"/><published>2024-12-06T17:12:10+00:00</published><updated>2024-12-06T17:12:10+00:00</updated><id>https://simonwillison.net/2024/Dec/6/dsql-vignette-reads-and-compute/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://brooker.co.za/blog/2024/12/04/inside-dsql.html"&gt;DSQL Vignette: Reads and Compute&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Marc Brooker is one of the engineers behind AWS's new &lt;a href="https://simonwillison.net/2024/Dec/3/amazon-aurora-dsql/"&gt;Aurora DSQL&lt;/a&gt; horizontally scalable database. Here he shares all sorts of interesting details about how it works under the hood.&lt;/p&gt;
&lt;p&gt;The system is built around the principle of separating storage from compute: storage uses S3, while compute runs in Firecracker:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Each transaction inside DSQL runs in a customized Postgres engine inside a Firecracker MicroVM, dedicated to your database. When you connect to DSQL, we make sure there are enough of these MicroVMs to serve your load, and scale up dynamically if needed. We add MicroVMs in the AZs and regions your connections are coming from, keeping your SQL query processor engine as close to your client as possible to optimize for latency.&lt;/p&gt;
&lt;p&gt;We opted to use PostgreSQL here because of its pedigree, modularity, extensibility, and performance. We’re not using any of the storage or transaction processing parts of PostgreSQL, but are using the SQL engine, an adapted version of the planner and optimizer, and the client protocol implementation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The system then provides strong repeatable-read transaction isolation using MVCC and EC2's high precision clocks, enabling reads "as of time X" including against nearby read replicas.&lt;/p&gt;
&lt;p&gt;The storage layer supports index scans, which means the compute layer can push down some operations allowing it to load a subset of the rows it needs, reducing round-trips that are affected by speed-of-light latency.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The overall approach here is &lt;em&gt;disaggregation&lt;/em&gt;: we’ve taken each of the critical components of an OLTP database and made it a dedicated service. Each of those services is independently horizontally scalable, most of them are shared-nothing, and each can make the design choices that is most optimal in its domain.&lt;/p&gt;
&lt;/blockquote&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/architecture"&gt;architecture&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/aws"&gt;aws&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/databases"&gt;databases&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ec2"&gt;ec2&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/postgresql"&gt;postgresql&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/s3"&gt;s3&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/scaling"&gt;scaling&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/firecracker"&gt;firecracker&lt;/a&gt;&lt;/p&gt;



</summary><category term="architecture"/><category term="aws"/><category term="databases"/><category term="ec2"/><category term="postgresql"/><category term="s3"/><category term="scaling"/><category term="firecracker"/></entry><entry><title>Why We Replaced Firecracker with QEMU</title><link href="https://simonwillison.net/2023/Jul/10/why-we-replaced-firecracker-with-qemu/#atom-tag" rel="alternate"/><published>2023-07-10T15:09:03+00:00</published><updated>2023-07-10T15:09:03+00:00</updated><id>https://simonwillison.net/2023/Jul/10/why-we-replaced-firecracker-with-qemu/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://hocus.dev/blog/qemu-vs-firecracker/"&gt;Why We Replaced Firecracker with QEMU&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Hocus are building a self-hosted alternative to cloud development environment tools like GitPod and Codespaces. They moved away from Firecracker because it’s optimized for short-running (AWS Lambda style) functions—which means it never releases allocated RAM or storage volume space back to the host machine unless the container is entirely restarted. It also lacks GPU support.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://news.ycombinator.com/item?id=36666782"&gt;Hacker News&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/qemu"&gt;qemu&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/virtualization"&gt;virtualization&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/firecracker"&gt;firecracker&lt;/a&gt;&lt;/p&gt;



</summary><category term="qemu"/><category term="virtualization"/><category term="firecracker"/></entry><entry><title>Weeknotes: Building Datasette Cloud on Fly Machines, Furo for documentation</title><link href="https://simonwillison.net/2022/May/26/weeknotes-building-datasette-cloud/#atom-tag" rel="alternate"/><published>2022-05-26T04:35:11+00:00</published><updated>2022-05-26T04:35:11+00:00</updated><id>https://simonwillison.net/2022/May/26/weeknotes-building-datasette-cloud/#atom-tag</id><summary type="html">
    &lt;p&gt;Hosting provider Fly released &lt;a href="https://fly.io/blog/fly-machines/"&gt;Fly Machines&lt;/a&gt; this week. I got an early preview and I've been working with it for a few days - it's a &lt;em&gt;fascinating&lt;/em&gt; new piece of technology. I'm using it to get my hosting service for Datasette ready for wider release.&lt;/p&gt;
&lt;h4&gt;Datasette Cloud&lt;/h4&gt;
&lt;p&gt;Datasette Cloud is the name I've given my forthcoming hosted SaaS version of Datasette. I'm building it for two reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;This is an obvious step towards building a sustainable business model for my open source project. It's a reasonably well-trodden path at this point: plenty of projects have demonstrated that offering paid hosting for an open source project can build a valuable business. &lt;a href="https://gitlab.com/"&gt;GitLab&lt;/a&gt; are an especially good example of this model.&lt;/li&gt;
&lt;li&gt;There are plenty of people who could benefit from Datasette, but the friction involved in hosting it prevents them from taking advantage of the software. I've tried to make it &lt;a href="https://docs.datasette.io/en/stable/deploying.html"&gt;as easy to host&lt;/a&gt; as possible, but without a SaaS hosted version I'm failing to deliver value to the people that I most want the software to help.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;My previous alpha was built directly on Docker, running everything on a single large VPS. Obviously it needed to scale beyond one machine, and I started experimenting with Kubernetes to make this happen.&lt;/p&gt;
&lt;p&gt;I also want to allow users to run their own plugins, without risk of malicious code causing problems for other accounts. Docker and Kubernetes containers don't offer the isolation that I need to feel comfortable doing this, so I started researching &lt;a href="https://firecracker-microvm.github.io/"&gt;Firecracker&lt;/a&gt; - constructed by AWS to power Lambda and Fargate, so very much designed with potentially malicious code in mind.&lt;/p&gt;
&lt;p&gt;Spinning up Firecracker on a Kubernetes cluster is no small lift!&lt;/p&gt;
&lt;p&gt;And then I heard about &lt;a href="https://fly.io/blog/fly-machines/"&gt;Fly Machines&lt;/a&gt;. And it looks like it's exactly what I need to get this project to the next milestone.&lt;/p&gt;
&lt;h4&gt;Fly Machines&lt;/h4&gt;
&lt;p&gt;Fly's core offering allows you to run Docker containers in regions around the world, compiled (automatically by Fly) to Firecracker containers with geo-load-balancing so users automatically get routed to an instance running near them.&lt;/p&gt;
&lt;p&gt;Their new Fly Machines product gives you a new way to run containers there: you get full control over when containers are created, updated, started, stopped and destroyed. It's the exact level of control I need to build Datasette Cloud.&lt;/p&gt;
&lt;p&gt;It also implements scale-to-zero: you can stop a container, and Fly will automatically start it back up again for you (generally in less than a second) when fresh traffic comes in.&lt;/p&gt;
&lt;p&gt;(I had built my own version of this for my Datasette Cloud alpha, but the spin up time took more like 10s and involved showing the user a custom progress bar to help them see what was going on.)&lt;/p&gt;
&lt;p&gt;Being able to programatically start and stop Firecracker containers was exactly what I'd been trying to piece together using Kubernetes - and the ability to control which global region they go in (with the potential for &lt;a href="https://tip.litestream.io/guides/read-replica/"&gt;Litestream replication&lt;/a&gt; between regions in the future) is a feature I hadn't expected to be able to offer for years.&lt;/p&gt;
&lt;p&gt;So I spent most of this week on a proof of concept. I've successfully demonstrated that the Fly Machines product has almost exactly the features that I need to ship Datasette Cloud on Fly Machines - and I've confirmed that the gaps I need to fill are on Fly's near-term roadmap.&lt;/p&gt;
&lt;p&gt;I don't have anything to demonstrate publicly just yet, but I do have &lt;a href="https://til.simonwillison.net/fly"&gt;several new TILs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If this sounds interesting to you or your organization and you'd like to try it out, drop me an email at &lt;code&gt;swillison&lt;/code&gt; @ Google's email service.&lt;/p&gt;
&lt;h4 id="furo-theme"&gt;The Furo theme for Sphinx&lt;/h4&gt;
&lt;p&gt;My &lt;a href="https://github.com/simonw/shot-scraper"&gt;shot-scraper&lt;/a&gt; automated screenshot tool's README had got a little too long, so I decided to upgrade it to &lt;a href="https://shot-scraper.datasette.io/"&gt;a full documentation website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I chose to use &lt;a href="https://myst-parser.readthedocs.io/"&gt;MyST&lt;/a&gt; and &lt;a href="https://www.sphinx-doc.org/"&gt;Sphinx&lt;/a&gt; for this, hosted on &lt;a href="https://www.readthedocs.org/"&gt;Read The Docs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;MyST adds Markdown syntax to Sphinx, which is easier to remember (and for people to contribute to) than reStructuredText.&lt;/p&gt;
&lt;p&gt;After putting the site live, Adam Johnson &lt;a href="https://twitter.com/AdamChainz/status/1527666472193081345"&gt;suggested&lt;/a&gt; I take a look at the &lt;a href="https://github.com/pradyunsg/furo"&gt;Furo theme&lt;/a&gt;. I'd previously found Sphinx themes hard to navigate because they had so much differing functionality, but a personal recommendation turned out to be exactly what I needed.&lt;/p&gt;
&lt;p&gt;Furo is really nice - it fixed a slight rendering complaint I had about nested lists in the theme I was using, and since it doesn't use web fonts it dropped the bytes transferred for a page of documentation by more than half!&lt;/p&gt;
&lt;p&gt;I switched &lt;code&gt;shot-scraper&lt;/code&gt; over to Furo, and liked it so much that I switched over &lt;a href="https://docs.datasette.io/en/latest/"&gt;Datasette&lt;/a&gt; and &lt;a href="https://sqlite-utils.datasette.io/en/latest/"&gt;sqlite-utils&lt;/a&gt; too.&lt;/p&gt;
&lt;p&gt;Here's what the &lt;code&gt;shot-scraper&lt;/code&gt; documentation looks like now:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://static.simonwillison.net/static/2022/shot-scraper-docs.png" alt="A screenshot of the shot-scraper documentation, showing the table of contents" style="max-width:100%;" /&gt;&lt;/p&gt;
&lt;p&gt;Screenshot taken using &lt;code&gt;shot-scraper&lt;/code&gt; itself, like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;shot-scraper \
  https://shot-scraper.datasette.io/en/latest/ \
  --retina --height 1200
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Full details of those theme migrations (including more comparative screenshots) can be found in these issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/simonw/shot-scraper/issues/77"&gt;shot-scraper: Switch to Furo theme #77&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/simonw/datasette/issues/1746"&gt;datasette: Switch documentation theme to Furo #1746&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/simonw/sqlite-utils/issues/435"&gt;sqlite-utils:  Switch to Furo documentation theme #435&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Releases this week&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/simonw/datasette-unsafe-expose-env"&gt;datasette-unsafe-expose-env&lt;/a&gt;&lt;/strong&gt;: &lt;a href="https://github.com/simonw/datasette-unsafe-expose-env/releases/tag/0.1"&gt;0.1&lt;/a&gt; - 2022-05-25
&lt;br /&gt;Datasette plugin to expose some environment variables at /-/env for debugging&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/simonw/shot-scraper"&gt;shot-scraper&lt;/a&gt;&lt;/strong&gt;: &lt;a href="https://github.com/simonw/shot-scraper/releases/tag/0.14.1"&gt;0.14.1&lt;/a&gt; - (&lt;a href="https://github.com/simonw/shot-scraper/releases"&gt;16 releases total&lt;/a&gt;) - 2022-05-22
&lt;br /&gt;A comand-line utility for taking automated screenshots of websites&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/simonw/google-calendar-to-sqlite"&gt;google-calendar-to-sqlite&lt;/a&gt;&lt;/strong&gt;: &lt;a href="https://github.com/simonw/google-calendar-to-sqlite/releases/tag/0.1a0"&gt;0.1a0&lt;/a&gt; - 2022-05-21
&lt;br /&gt;Create a SQLite database containing your data from Google Calendar&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/simonw/datasette-upload-dbs"&gt;datasette-upload-dbs&lt;/a&gt;&lt;/strong&gt;: &lt;a href="https://github.com/simonw/datasette-upload-dbs/releases/tag/0.1.1"&gt;0.1.1&lt;/a&gt; - (&lt;a href="https://github.com/simonw/datasette-upload-dbs/releases"&gt;2 releases total&lt;/a&gt;) - 2022-05-17
&lt;br /&gt;Upload SQLite database files to Datasette&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/simonw/datasette-insert"&gt;datasette-insert&lt;/a&gt;&lt;/strong&gt;: &lt;a href="https://github.com/simonw/datasette-insert/releases/tag/0.7"&gt;0.7&lt;/a&gt; - (&lt;a href="https://github.com/simonw/datasette-insert/releases"&gt;7 releases total&lt;/a&gt;) - 2022-05-16
&lt;br /&gt;Datasette plugin for inserting and updating data&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;TIL this week&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://til.simonwillison.net/github-actions/job-summaries"&gt;GitHub Actions job summaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://til.simonwillison.net/github-actions/oxipng"&gt;Optimizing PNGs in GitHub Actions using Oxipng&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://til.simonwillison.net/fly/fly-docker-registry"&gt;Using the Fly Docker registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://til.simonwillison.net/fly/fly-logs-to-s3"&gt;Writing Fly logs to S3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://til.simonwillison.net/fly/wildcard-dns-ssl"&gt;Wildcard DNS and SSL on Fly&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
    
        &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/documentation"&gt;documentation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/projects"&gt;projects&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/datasette"&gt;datasette&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/weeknotes"&gt;weeknotes&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/datasette-cloud"&gt;datasette-cloud&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/fly"&gt;fly&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/firecracker"&gt;firecracker&lt;/a&gt;&lt;/p&gt;
    

</summary><category term="documentation"/><category term="projects"/><category term="datasette"/><category term="weeknotes"/><category term="datasette-cloud"/><category term="fly"/><category term="firecracker"/></entry><entry><title>Behind the scenes, AWS Lambda</title><link href="https://simonwillison.net/2021/Jul/10/behind-the-scenes-aws-lambda/#atom-tag" rel="alternate"/><published>2021-07-10T19:40:06+00:00</published><updated>2021-07-10T19:40:06+00:00</updated><id>https://simonwillison.net/2021/Jul/10/behind-the-scenes-aws-lambda/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.bschaatsbergen.com/behind-the-scenes-lambda"&gt;Behind the scenes, AWS Lambda&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Bruno Schaatsbergen pulled together details about how AWS Lambda works under the hood from a detailed review of the AWS documentation, the Firecracker paper and various talks at AWS re:Invent.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://news.ycombinator.com/item?id=27792951"&gt;Hacker News&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/aws"&gt;aws&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/lambda"&gt;lambda&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/software-architecture"&gt;software-architecture&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/firecracker"&gt;firecracker&lt;/a&gt;&lt;/p&gt;



</summary><category term="aws"/><category term="lambda"/><category term="software-architecture"/><category term="firecracker"/></entry></feed>