How does the performance of this compared to running ruby and packages like mongo direct on Mac natively on M1? - I'm quite impressed how well rails runs natively on these new MacBooks.
☒ I just ran some benchmarks and they're pretty interesting. The M1 does have some overhead in Docker, but is still very performant. Even running Ruby in Docker on the M1 is faster than the Mac Pro 8-Core.
Apple M1 (Host Ruby ARM)
Warming up --------------------------------------
for 5.000 i/100ms
times 5.000 i/100ms
upto 4.000 i/100ms
Calculating -------------------------------------
for 51.465 (± 0.0%) i/s - 260.000 in 5.052005s
times 49.005 (± 0.0%) i/s - 250.000 in 5.101558s
upto 48.883 (± 0.0%) i/s - 248.000 in 5.073392s
Comparison:
for: 51.5 i/s
times: 49.0 i/s - 1.05x (± 0.00) slower
upto: 48.9 i/s - 1.05x (± 0.00) slower
Apple M1 (Docker Ruby ARM)
Warming up --------------------------------------
for 3.000 i/100ms
times 4.000 i/100ms
upto 4.000 i/100ms
Calculating -------------------------------------
for 36.880 (± 0.0%) i/s - 186.000 in 5.043469s
times 42.139 (± 0.0%) i/s - 212.000 in 5.031015s
upto 42.166 (± 0.0%) i/s - 212.000 in 5.027795s
Comparison:
upto: 42.2 i/s
times: 42.1 i/s - 1.00x (± 0.00) slower
for: 36.9 i/s - 1.14x (± 0.00) slower
Mac Pro 8-Core (Host Ruby x86)
Warming up --------------------------------------
for 2.000 i/100ms
times 2.000 i/100ms
upto 2.000 i/100ms
Calculating -------------------------------------
for 28.364 (± 3.5%) i/s - 142.000 in 5.011655s
times 28.477 (± 3.5%) i/s - 144.000 in 5.059955s
upto 28.810 (± 3.5%) i/s - 144.000 in 5.002301s
Comparison:
upto: 28.8 i/s
times: 28.5 i/s - same-ish: difference falls within error
for: 28.4 i/s - same-ish: difference falls within error
Mac Pro 8-Core (Docker Ruby x86)
Warming up --------------------------------------
for 3.000 i/100ms
times 3.000 i/100ms
upto 3.000 i/100ms
Calculating -------------------------------------
for 34.549 (± 2.9%) i/s - 174.000 in 5.043895s
times 35.430 (± 2.8%) i/s - 177.000 in 5.000668s
upto 35.783 (± 2.8%) i/s - 180.000 in 5.036034s
Comparison:
upto: 35.8 i/s
times: 35.4 i/s - same-ish: difference falls within error
for: 34.5 i/s - same-ish: difference falls within error
I'm hitting this error when following along and running docker-compose up with all the files looking just like in the video
=> ERROR [ 5/13] RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 0.6s
------
> [ 5/13] RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -:
#9 0.285 Warning: apt-key output should not be parsed (stdout is not a terminal)
#9 0.543 gpg: no valid OpenPGP data found.
#9 0.543 Segmentation fault
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -]: exit code: 2
What could be a possible solution? I'm in an Apple M1 Pro running Monterey, if that is relevant. Also, I'm trying to use Rails 6.1.4.6 instead of the latest stable version.
Hmmm... After googling for a bit and trying different things, I was able to make it work by eliminating that part and installing yarn after nodejs like this:
RUN npm install -g yarn
At least, running docker-compose up worked. Not sure if I will run into other issues in the next step.
FROM ruby:$RUBY_VERSION-slim-buster
instead of
FROM ruby:$RUBY_VERSION
What could be a possible solution? I'm in an Apple M1 Pro running Monterey, if that is relevant. Also, I'm trying to use Rails 6.1.4.6 instead of the latest stable version.
Thanks in advance for any help!
RUN npm install -g yarn
At least, running docker-compose up worked. Not sure if I will run into other issues in the next step.