-
Notifications
You must be signed in to change notification settings - Fork 72
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
Gradle daemon incredibly slow to start on macOS #215
Comments
If you are on Docker Desktop, consider docker/roadmap#7 |
Excuse me for not giving you that detail but I'm on the latest macOS version with experimental features. I tried with and without and it's building at that exact same speed |
Okay so I published on GitHub the Dockerfile I'm talking about. I built the image on my Mac and pushed it to the Docker Hub(The 2.1-area was amd64 only which was decreasing perf on my machine), everything looks fine but when I'm trying to build a container using it, the Gradle daemon is starting way faster 70sec ~ (which is normal) but failed to install Full error:
|
You'd have to install the Android SDK yourself. This image is just Gradle, not anything else. |
That's actually what I'm doing.
package.txt:
The thing is that the build is working on amd64 with the gradle daemon but crashing on M1 because of the above Error. |
I don't have a device with Apple silicon to test on and haven't confirmed the state of Android SDK support on that hardware (though it was my understanding it was supposed to work). One potential workaround would be to use install Rosetta 2 and use |
It's also slow on Windows. Same for WSL on Windows. |
I don't really understand what you mean by using Rosetta, the SDK is already based on
I also tried with the macOS install but still the same prob |
I'm talking about the argument to |
If I do that, my image would be incredibly slow: cf the first screenshot of this issue |
That's unsurprising, but my understanding is that there's Arm binaries for MacOS, but not for Linux, and hence not any for the Docker image that would be used on that hardware. I'd seen a couple references to compiling the build tools to target Arm, though I haven't found any recent documentation of that. |
@danon is your use case also regarding Android SDK? |
No, it's also for a vanilla hello world java gradle. |
In your case is the daemon slow to start also?There are a lot of things that can impact performance. Was the project in a volume? If so, what was the storage driver? Do you get the same poor performance after Gradle has run once and stuff is cached? If you enable verbose logging, does that give any indication what's taking time? |
@keeganwitt This is a repo you can use to demonstrate it. https://github.com/Danon/Fish When I clone it and run it on |
Documenting some research (using your Fish project as a test): Measure-Command { docker run --rm -v "${pwd}:/home/gradle/project" -w /home/gradle/project gradle:latest gradle --no-daemon --profile tasks | Out-Default }
Remove-Item build -Recurse
Remove-Item .gradle -Recurse
Measure-Command { gradle --no-daemon --profile tasks | Out-Default }
Remove-Item build -Recurse
Remove-Item .gradle -Recurse On my machine local is about 10 seconds compared to about a minute in Docker. To rule in/out the volume as being a performance impact, I created FROM gradle
RUN mkdir /home/gradle/project
WORKDIR /home/gradle/project
COPY build.gradle.kts .
COPY src/ ./src Then ran docker build -t gradle-time .
docker run --rm gradle-time gradle tasks
Measure-Command { docker run --rm gradle-time bash -c 'gradle --no-daemon --profile tasks; cat build/reports/profile/*.html' | Out-Default } This didn't have any significant performance difference compared to using the volume. Most of the time spent was in the configuration step, but looking at the output from Measure-Command { docker run --rm -v "${pwd}:/home/gradle/project" -w /home/gradle/project gradle:latest gradle --no-daemon -d tasks | Tee-Object -FilePath docker.out } | Tee-Object -FilePath docker.out -Append It wasn't clear that any particular log step took the majority of the time. My current guess is filesystem performance. Although I'm not sure if that's from the storage driver, the VM, or what. |
So I created my own image based on the official Gradle one to build React Native app from containers and I'm using the
./gradlew assembleRelease
in the/android
folder but the daemon is taking more then 2500sec to start (see below).The problem is that when I'm on WSL the build is working just fine (less than 700sec) and I just don't understand why it does not work on macOS (I've an M1 chip)
The text was updated successfully, but these errors were encountered: