SQLite is an open-source in-process SQL database engine that makes it
easy to build portable, self-contained databases. Because SQLite stores each database in a single file, it
works naturally with Archil — just create your .db file on an Archil mount.
SQLite doesn’t need to know anything about Archil or S3. It reads and writes files as usual, and Archil
handles caching on fast SSD storage and synchronizing to S3 in the background. This is especially useful for
organizations that create a SQLite database per user — you only pay for the databases that are actively being
accessed.
Create an Archil disk
First, follow the Archil Getting Started Guide to create an Archil disk.
Install SQLite
On Amazon Linux 2023, you can install SQLite with the following command:
sudo dnf install sqlite -y
Next, mount your Archil disk to an easy to access directory.
sudo mkdir -p /mnt/archil
export ARCHIL_MOUNT_TOKEN="<token>"
sudo --preserve-env=ARCHIL_MOUNT_TOKEN archil mount <disk-name> /mnt/archil --region aws-us-east-1
Now, you can create a SQLite database on Archil. Simply cd to the Archil disk and create a new database file.
cd /mnt/archil
sqlite3 my_database.db
You can use the SQLite database as normal.
(Optional) Run a benchmark to validate performance
We’ll do a performance benchmark of sqlite using the speedtest1 tool from the SQLite authors.
Let’s install and compile this tool.
git clone https://github.com/sqlite/sqlite.git
cd sqlite
./configure --all
make clean speedtest1
Then, run a benchmark.
sudo ./speedtest1 /mnt/archil/performance_test.db