This benchmark provides a overview of the different SQLite driver performances available in Go.


SQLite/HTTP Server Performance Benchmark

This benchmark provides a overview of the different SQLite driver performances available in Go. For benchmarking a simple HTTP server is used to perform random read queries on the database.

For benchmarking the hey load generator is used to call the HTTP server (with 50 concurrent requests).

Driver Overview

Package Uses CGo Is driver for database/sql
crawshaw.io/sqlite Yes No
github.com/mattn/go-sqlite3 Yes Yes
modernc.org/sqlite No Yes
zombiezen.com/go/sqlite No No

Implementation

The implementation consists of a simple HTTP server that runs a single select query on the SQLite database for each request.

SELECT * FROM foo WHERE rowid = ? -- where ? is a random number between 1 and 10000

The SQLite database has the following schema and contains 100000 rows with random values.

CREATE TABLE foo (id integer, value integer);

See any of the subfolder/main.go files for more details.

Benchmark

The benchmark was run on a MacBook Pro 2020 with a 2.3 GHz Quad-Core Intel Core i7 and 32 GB of RAM.

The server is started with a configurable number of "connections" to the SQLite database, here called poolsize. Once the server is running hey is used to run the HTTP load test. See runbenchmark.go for details.

All reports of hey can be found in the result_*.txt files.

Result

package    poolsize   req/sec

crawshaw          1     24974
crawshaw          4     53092
crawshaw          8     51138
crawshaw         50     48494
crawshaw        100     39702

mattn             1     20807
mattn             4     50185
mattn             8     39778
mattn            50     28849
mattn           100     32546

modernc           1     19209
modernc           4     41386
modernc           8     39482
modernc          50     10169
modernc         100      7488

zombiezen         1     22829
zombiezen         4     55161
zombiezen         8     55505
zombiezen        50     59762
zombiezen       100     36622

Observations

  • The performance results between the packages do not differ that much.
  • Limiting the number of connections/poolsize to the SQLite database to roughly the number of CPU cores on the machine gives best performance results.
Owner
Philipp Tanlak
Author of PHP str_contains(...)
Philipp Tanlak
Similar Resources

Random - A Golang library that provides functions for generating random values

Random A Golang library that provides functions for generating random values. Us

Apr 14, 2022

Go-driver-benchmark - Driver benchmark with golang

We use ClickkHouse for time-series databases, and the driver's performance is ve

Sep 5, 2022

Redis-benchmark - Simple get, mget and pipelined get benchmark.

redis-benchmark Simple get, mget and pipelined get benchmark. Usage git clone https://github.com/Ali-A-A/redis-benchmark.git cd ./redis-benchmark dock

Dec 31, 2021

Bxd redis benchmark - Redis benchmark tool for golang

使用 redis benchmark 工具, 测试 10 20 50 100 200 1k 5k 字节 value 大小,redis get set 性能。 r

Jan 22, 2022

Benchmark - Benchmark of logr implementations

Benchmark of logr implementations Implementations a function (can bridge to non-

Jul 19, 2022

Dbench - An unscientific benchmark of SQLite vs the file system (btrfs)

DBENCH Basic benchmarks for SQLite vs file system (btrfs on a 2020 Dell XPS SSD)

May 20, 2022

This is a simple graph database in SQLite, inspired by "SQLite as a document database".

About This is a simple graph database in SQLite, inspired by "SQLite as a document database". Structure The schema consists of just two structures: No

Sep 5, 2022

Package sqlite is a CGo-free port of SQLite.

sqlite Package sqlite is a CGo-free port of SQLite. SQLite is an in-process implementation of a self-contained, serverless, zero-configuration, transa

Nov 30, 2021

Andrews-monitor - A Go program to monitor when times were available to order for Brown's Andrews dining hall. Used during the portion of the pandemic when the dining hall was only available for online order.

Andrews Dining Hall Monitor A Go program to monitor when times were available to order for Brown's Andrews dining hall. Used during the portion of the

Jan 1, 2022

Devcloud-go provides a sql-driver for mysql which named devspore driver and a redis client which named devspore client,

Devcloud-go Devcloud-go provides a sql-driver for mysql which named devspore driver and a redis client which named devspore client, you can use them w

Jun 9, 2022

Go Cheat Sheet - An overview of Go syntax and features.

Go Cheat Sheet - An overview of Go syntax and features.

Sep 27, 2022

Aquatone is a tool for visual inspection of websites across a large amount of hosts and is convenient for quickly gaining an overview of HTTP-based attack surface.

Aquatone is a tool for visual inspection of websites across a large amount of hosts and is convenient for quickly gaining an overview of HTTP-based attack surface.

Sep 25, 2022

Asynchronously control the different roles available in the kubernetes cluster

RBAC audit Introduction This tool allows you to asynchronously control the different roles available in the kubernetes cluster. These audits are enter

Oct 19, 2021

Golang database driver for SQLite

go-sqlite Golang database driver for SQLite. Does not use cgo. This driver is based on pure-Go SQLite implementation (https://gitlab.com/cznic/sqlite)

Sep 16, 2022

CSPFinder is a tool to compare ROI of selling Cash Secure Put options between different tickers for different expiry dates.

CSPFinder is a tool to compare ROI of selling Cash Secure Put options between different tickers for different expiry dates. It is intended to help open new cash secured put positions.

Dec 21, 2021

Plugs module to see different types of plug types needed in different countries, and a comparison tool between two countries plug socket types.

plugs Importing the module: go get github.com/matthewboyd/plugs "github.com/matthewboyd/plugs" How to use the module: There are two functions wi

Dec 28, 2021

Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package

Go-MySQL-Driver A MySQL-Driver for Go's database/sql package Features Requirements Installation Usage DSN (Data Source Name) Password Protocol Address

Sep 22, 2022

Qmgo - The Go driver for MongoDB. It‘s based on official mongo-go-driver but easier to use like Mgo.

Qmgo English | 简体中文 Qmgo is a Go driver for MongoDB . It is based on MongoDB official driver, but easier to use like mgo (such as the chain call). Qmg

Sep 21, 2022
Continuous Benchmark for Go Project
Continuous Benchmark for Go Project

Abstract cob compares benchmarks between the latest commit (HEAD) and the previous commit (HEAD{@1}). The program will fail if the change in score is

Sep 13, 2022
The test suite to demonstrate the chaos experiment behavior in different scenarios

Litmus-E2E The goal of litmus e2e is to provide the test suite to demonstrate the chaos experiment behavior in different scenarios. As the name sugges

Jul 7, 2022
Sql mock driver for golang to test database interactions

Sql driver mock for Golang sqlmock is a mock library implementing sql/driver. Which has one and only purpose - to simulate any sql driver behavior in

Sep 27, 2022
Immutable transaction isolated sql driver for golang

Single transaction based sql.Driver for GO Package txdb is a single transaction based database sql driver. When the connection is opened, it starts a

Sep 13, 2022
A Devtools driver for web automation and scraping

Overview Documentation | API reference Rod is a high-level driver directly based on DevTools Protocol. It's designed for web automation and scraping.

Sep 24, 2022
Package cdp provides type-safe bindings for the Chrome DevTools Protocol (CDP), written in the Go programming language.

cdp Package cdp provides type-safe bindings for the Chrome DevTools Protocol (CDP), written in the Go programming language. The bindings are generated

Sep 27, 2022
A next-generation testing tool. Orion provides a powerful DSL to write and automate your acceptance tests

Orion is born to change the way we implement our acceptance tests. It takes advantage of HCL from Hashicorp t o provide a simple DSL to write the acceptance tests.

Aug 31, 2022
🏳️ Go package that provides function like assert of Python or C++.

gassert gassert is Go package that provides function like assert of Python or C++. With gassert, you can check validation of parameters or values more

Aug 5, 2022
testtime provides time.Now for testing.

testtime provides time.Now for testing.

Aug 31, 2022
Snapshot - snapshot provides a set of utility functions for creating and loading snapshot files for using snapshot tests.

Snapshot - snapshot provides a set of utility functions for creating and loading snapshot files for using snapshot tests.

Jan 27, 2022