惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
H
Help Net Security
小众软件
小众软件
N
Netflix TechBlog - Medium
C
Check Point Blog
量子位
Last Week in AI
Last Week in AI
GbyAI
GbyAI
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
博客园 - 聂微东
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
D
DataBreaches.Net
Project Zero
Project Zero
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Security Latest
Security Latest
Cisco Talos Blog
Cisco Talos Blog
Recorded Future
Recorded Future
I
Intezer
L
Lohrmann on Cybersecurity
Cyberwarzone
Cyberwarzone
博客园_首页
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
P
Palo Alto Networks Blog
V
V2EX
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
The Hacker News
The Hacker News
Blog — PlanetScale
Blog — PlanetScale
G
GRAHAM CLULEY
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
The Register - Security
The Register - Security
L
LINUX DO - 热门话题
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
F
Full Disclosure
博客园 - 司徒正美
Recent Announcements
Recent Announcements
IT之家
IT之家
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Attack and Defense Labs
Attack and Defense Labs
Cloudbric
Cloudbric
Help Net Security
Help Net Security
The Last Watchdog
The Last Watchdog

Fathom blog RSS

Two database migrations and a divorce - Fathom Analytics Fathom acquires Gauges Announcing: Fathom V4 Shipping faster with more confidence How to fix Stripe payment attempt failed because additional action is required Fathom Analytics has been acquired Google Analytics is deleting all of your historical data I made a mistake Reducing our AWS bill by $100,000 How to Enable and Use Link Tracking Protection in iOS 17 How we built our referral program Why Fathom Analytics doesn’t have a free plan Migrating a 2TB database in 7.5 minutes Can you still export Universal Analytics data? Building our Google Analytics Importer Our Google Analytics Importer is now available How to have multiple unique columns in SingleStore Your privacy resolutions for 2023 Filter your dashboard by event completions Counting Clicks: A Use Case for Grouping Fathom Events
SingleStore is now faster on Apple Silicon
Jack Ellis · 2023-01-13 · via Fathom blog RSS

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.

Benchmarks

A few notes for the benchmarks you’ll be seeing below:

  1. SingleStore uses something called a query plan cache. Long story short, the first time you run a query, there’s a slight lag as SingleStore’s engine decides on the BEST way to run the query. The benchmarks are run after that initial query plan cache has run because, in production, this initial query plan cache run is irrelevant.
  2. The benchmark values are an average of 5 runs.
  3. I profiled these queries via SingleStore studio.
  4. I’m running on SingleStore 8.0.4.
  5. My machine is a MacBook Air M1 2020, so many of you will see WAY better performance than me (e.g. if you’re on a newer MBA or MBP).
  6. The benchmarks are done in milliseconds, and I’ve rounded to 2 decimal places.
  7. The benchmarks are not testing for concurrency because this is local development.

Now let’s get to testing.

Basic queries

I’ve performed some basic CRUD queries below and some database creation to see how these behave.

QueryBefore RosettaAfter enabling RosettaHow much faster is Rosetta?
CREATE DATABASE test;3,083 ms2,954.75 ms4.16%
DROP DATABASE test;939 ms740.33 ms21.15%
CREATE TABLE users (id BIGINT AUTO_INCREMENT PRIMARY KEY, name TEXT, email TEXT);121 ms28.75 ms76.24%
INSERT INTO users (id, name, email) VALUES (1, ‘Jack Ellis’, ‘jack.ellis@google-analytics.com’);5.4 ms2.66 ms50.74%
SELECT * FROM users WHERE id = 1;4.8 ms2.5 ms47.91%
UPDATE users SET name = ‘Jack Google’ WHERE id = 1;6 ms3 ms50%
DELETE FROM users WHERE id = 1;5.8 ms2.25 ms61.21%

Aggregations

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.

QueryBefore RosettaAfter enabling RosettaHow much faster is Rosetta?
SELECT SUM(pageviews) from pageviews;67.6 ms7.4 ms89%
SELECT pathname, SUM(pageviews) as x from pageviews GROUP BY pathname ORDER BY x DESC LIMIT 100;125.2 ms16.2 ms87%
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 ms12 ms91%
UPDATE pageviews SET utm_campaign = ‘boop’;22,000 ms3,593 ms83.66%
DELETE FROM pageviews WHERE referrer_hostname = ‘https://laravel.com’;610.33 ms93 ms84.76%
DELETE FROM pageviews;488.5 ms44 ms90.99%

How do I enable Rosetta on Docker?

Easy peasy, simply:

  1. Update to latest Docker
  2. Go into Settings -> Features in development
  3. Tick the “Use Rosetta for x86/amd64 emulation on Apple Silicon

Additional notes

  1. Before enabling Rosetta, the Nodes page in SingleStore studio didn’t work and always showed 0% for both CPU and memory. With Rosetta, it works perfectly.
  2. Performing things such as INSERT INTO pageviews SELECT * FROM pageviews is so much faster when Rosetta is enabled
  3. Member of my SingleStore course, Franco Gilio, profiled and saw huge improvements too. His Laravel Nova searches went from 664ms to 166ms. Incredible.

Not bad

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.

Return to the Fathom Analytics blog

Jack Ellis

BIO
Jack Ellis, CTO

Tired of how time consuming and complex Google Analytics can be? Try Fathom Analytics:

Start a free trial