Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving performance of Singlestore dev docker image on M1/M2 apple machines #45

Open
msal-twingo opened this issue Aug 29, 2023 · 3 comments

Comments

@msal-twingo
Copy link

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:

image

It seems the emulation automatically chooses a very basic cpu which is missing many of the instructions sets for Singlestore to use:

image

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

image

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

image
image

@msal-twingo
Copy link
Author

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.

image

@kilobyte2007
Copy link

Toggling Rosetta on didn't really change anything for me. It's still very slow on my machine, making the development a pain.

@fgilio
Copy link

fgilio commented Nov 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants