4 ms·
The schema: CREATE TABLE IF NOT EXISTS users ( id BLOB PRIMARY KEY NOT NULL, created_at TEXT NOT NULL, username TEXT NOT NULL )
by VWWHFSfQ 4y ago
The schema:
CREATE TABLE IF NOT EXISTS users (
id BLOB PRIMARY KEY NOT NULL,
created_at TEXT NOT NULL,
username TEXT NOT NULL
);
The data:
let user = User {
id: uuid::Uuid::new_v4(),
created_at: chrono::Utc::now(),
username: String::from("Hello"),
};
If you can't insert 15,000 of these records per second then there's something wrong with your database. I'm aware that people are all on the SQLite hype train, but this kind of stuff is table-stakes.
I really like SQLite. But this blog isn't any kind of great performance indicator for it.
- snacktaster 4y agoThis entire post reduces to: insert into users (id, created_at, username) values ("<id>", "<created_at>", "Hello"), ...15,000 times. And we're going to be impressed with sqlite's performance?
- Aeolun 4y agoWell, some people think 3 inserts per second is fast, so maybe it gives some perspective? To be fair, I wouldn’t expect those to hang around hackernews though.
- ZephyrBlu 4y agoI think a lot of people have forgotten or don't know how powerful CPUs are. Simple operations should be insanely fast, like easily sub-millisecond if not sub-nanosecond fast.
- Aeolun 4y agoYou can double the performance of this whole thing by inserting 2 values at a time.
- eyegor 4y agoI don't see why you wouldn't just bundle them all into a transaction at that point. The idea of 1 insert at a time is to roughly estimate the overhead/perf in a real environment, where you're only adding 1 entry at a time.
- ijidak 4y agoBut, for insert, the CPU is not the bottleneck. It's I/O constrained. Disk I/O has always been the bottleneck for writes.
- jandrewrogers 4y agoCounterintuitively, write performance in modern databases is primarily constrained by disk read performance. That said, it is increasingly rare for disk I/O to be a bottleneck for inserts. When your storage will happily sustain 10+ GB/s of write throughput, you tend to run out of things like network and memory bandwidth first.
- Proven 4y ago[dead]
- zhte415 4y agoI think it's useful stress testing for when your product goes viral. For example, if the whole world wanted to create an account, and an account consisted of a UUID and a date, it'd take 5.4 days using this metric as a minimum viable benchmark. It's all about context, perception. 15,000 seems like a large number, and 1 second seems like a small amount of time. On the other hand, 5.4 days seems like quite a large number. Likewise at small scales, 15,000/second operated at a fidelity only able to capture 0.0005% of a typical processor's clock. Like a picture in a frame. This is not to say that the ability to casually write 15,000 things a second to a database is not impressive. Nor that a beowulf cluster of it wouldn't be.