Improving performance of Singlestore dev docker image on M1/M2 apple machines
msal-twingo opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
This is a feature request for improving performance of Singlestore dev docker image on M1/M2 apple machines.
In the github page it is described:
"In order to support running SingleStoreDB on Apple Silicon many of our performance optimizations are disabled. This can result in unexpectedly bad performance...
To tune this performance impact (either faster or slower) you can change the number of cores and amount of RAM..."
Unfortunately the above suggestion seems to be not enough, giving more CPU and RAM to the docker desktop does not help enough and some operations in Singlestore running on M1/M2 machines inside docker desktop still take minutes instead of seconds.
When this docker image is run on Apple M1/M2 machines in a docker desktop, the qemu emulation is used:
It seems the emulation automatically chooses a very basic cpu which is missing many of the instructions sets for Singlestore to use:
When running sdb-report collect-and-check command inside the docker image shell, you will receive the following notification about missing features of the CPU:
FAIL SSE4.2 CPU extensions unavailable on 127.0.0.1
WARN AVX2 CPU extensions unavailable on 127.0.0.1
Describe the solution you'd like
As a improvement feature I would like to have the ability to have the docker image with feature instructions Singlestore optimized for.
In recent years many developers use Apple M1/M2 machines to work on Singlestore projects and having an optimized environment is very important.
This can be via better emulation or via compiling the Singlestore to run natively on such CPU's.
I think the above change can improve the performance of the Singlestore docker image.
Describe alternatives you've considered
It is possible to control the above manually using for example colima instead of docker desktop (https://github.com/abiosoft/colima) ,which allows to specify parameters for qemu, without modifying the image.
Then it is possible to specify which cpu type you would like to simulate for the qemu to use.
But, this workaround requires manual and complex steps to make it work.
Additional context
Version information:
Singlestore 8.1.15 (docker pull ghcr.io/singlestore-labs/singlestoredb-dev:0.2.8)
Docker Desktop 4.22
Macbook M1 Pro (Ventura 13.4.1) with 16gb ram
8cores and 10gb allocated for the docker desktop
For whoever following this issue, it seems enabling the experimental feature of Rosetta emulation in docker desktop on M1/M2 is improving the performance in some cases.
I would suggest to try it to see if it helps in your case as a workaround.
You can find this setting under "Settings" > "Features in development" > "Beta features", see screenshot below
I tested it on docker desktop version 4.23.0 on M1 machine.
Toggling Rosetta on didn't really change anything for me. It's still very slow on my machine, making the development a pain.
While we wait for a solid performance improvement from the image itself... our team has seen tremendous performance improvement when using OrbStack https://orbstack.dev, really recommend you all to try it if you can