























laravel-tips Jack Ellis · Jan 13, 2023
The MacBook Silicon processors are incredible, there’s no debate there, and various tools have offered fantastic emulation for arm64 and other processor architectures. The problem is that it’s always been slow in some areas. Phase one of us running SingleStore on my MacBook M1 was made possible by work from Charlie Joseph, who managed to get SingleStore running on Docker via emulation. Phase two was made possible by Carl Sverre and his team via the SingleStoreDB Dev Image. And at this point, things were pretty good, but they still needed improvement, as emulation wasn’t as fast as we know it could be.
Fast forward to 12th January 2023, and Docker releases BETA support for emulation via Rosetta. We knew this was coming, and I’d been optimistic that performance would improve, and it has. But let’s stop with the talking and get to the benchmarks. After all, that’s why you’re here.
A few notes for the benchmarks you’ll be seeing below:
Now let’s get to testing.
I’ve performed some basic CRUD queries below and some database creation to see how these behave.
| Query | Before Rosetta | After enabling Rosetta | How much faster is Rosetta? |
|---|---|---|---|
| CREATE DATABASE test; | 3,083 ms | 2,954.75 ms | 4.16% |
| DROP DATABASE test; | 939 ms | 740.33 ms | 21.15% |
| CREATE TABLE users (id BIGINT AUTO_INCREMENT PRIMARY KEY, name TEXT, email TEXT); | 121 ms | 28.75 ms | 76.24% |
| INSERT INTO users (id, name, email) VALUES (1, ‘Jack Ellis’, ‘jack.ellis@google-analytics.com’); | 5.4 ms | 2.66 ms | 50.74% |
| SELECT * FROM users WHERE id = 1; | 4.8 ms | 2.5 ms | 47.91% |
| UPDATE users SET name = ‘Jack Google’ WHERE id = 1; | 6 ms | 3 ms | 50% |
| DELETE FROM users WHERE id = 1; | 5.8 ms | 2.25 ms | 61.21% |
Now we get into my favourite area, aggregations. I’ve loaded in 3,564,346 pageviews that belong to usefathom.com (our website). In reality, I wouldn’t be using this much data locally unless I was debugging a specific data issue. But I know we’ll see the most variance in the benchmarks if I use more data. Clearly, we’re not going to get the same performance as when SingleStore is running on intel processors but let’s see how things go.
| Query | Before Rosetta | After enabling Rosetta | How much faster is Rosetta? |
|---|---|---|---|
| SELECT SUM(pageviews) from pageviews; | 67.6 ms | 7.4 ms | 89% |
| SELECT pathname, SUM(pageviews) as x from pageviews GROUP BY pathname ORDER BY x DESC LIMIT 100; | 125.2 ms | 16.2 ms | 87% |
| SELECT pathname, SUM(pageviews) as x FROM pageviews WHERE referrer_hostname = ‘https://laravel.com’ GROUP BY pathname ORDER BY x DESC LIMIT 100; | 133.6 ms | 12 ms | 91% |
| UPDATE pageviews SET utm_campaign = ‘boop’; | 22,000 ms | 3,593 ms | 83.66% |
| DELETE FROM pageviews WHERE referrer_hostname = ‘https://laravel.com’; | 610.33 ms | 93 ms | 84.76% |
| DELETE FROM pageviews; | 488.5 ms | 44 ms | 90.99% |
Easy peasy, simply:
Overall, I’m very impressed by speed improvements. And Docker battery jokes aside, my battery life seems to be doing better. These benchmarks were tested by be manually, and they’re obviously not relevant for production, but I thought they’d be useful to do. I hope this post was helpful. And if you’re not in our community, make sure you check out SingleStore for Laravel, to learn how to use the fastest database in the world with Laravel.
BIO
Jack Ellis, CTO
Tired of how time consuming and complex Google Analytics can be? Try Fathom Analytics:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。