Intellij gradle project sync takes long time
Asked Answered
R

1

8

Gradle build command from terminal finishes in less than a minute but doing a refresh/sync on Intellij IDE taken 15 to 30 minutes. Tried to change the memory (-Xmx) to different levels 1g, 2g,3g upto 8g, still the time taken is in same range. Out project uses around 50 jars from maven/artifactory repo.

I profiled gradle process using YourKit Profiler, but not able to pin point and solve why it is taking so long. Never used YourKit before. Attached screenshots from YourKit below.

enter image description here

. enter image description here

Event Timeline shows most of the time is spent on "socket.Read" events (attached below), other events have very negligible time spent.

enter image description here

UPDATE: Using Gradle version 4.1

Roderic answered 5/1, 2018 at 1:9 Comment(13)
Gradle version? Is Intellij actually using the same Gradle as the terminal? The 50 jars shouldn't matter if they are downloaded onceUnruly
can you gradle build-scan to check out performance bottleneck? Also, what Gradle version?Loftis
IntelliJ may try downloading sources in addition to binary jars, which command-line gradle would not. If in addition there are network issues, and the binary jars are already downloaded, that would explain the difference.Nalepka
File support request with IDE log folder zipped and jstack thread dumps of a gradle daemon process when issue happens.Wien
Using Gradle version 4.1Roderic
@cricket_007 what do you mean by same Gradle? Gradle home environment path is set to use Gradle version 4.1, also the IntelliJ gradle settings points to the same 4.1 version.Roderic
@Nalepka how to stop Intellij from downloading sources? first of all how to check if it is trying to download sources or not? If you are talking about "source generation" option, then I tried "Skip source generation on Gradle sync..." option in Intellij, still no difference in project sync time.Roderic
I was asking if you are using the Gradle wrapper within a project, or the Gradle installation that's external to the IDEUnruly
@cricket_007 Installed Gradle separately, not gradlewRoderic
There was a bug in IntelliJ 2017.3 that affected the gradle sync performance: youtrack.jetbrains.com/issue/KT-21557 It was fixed in 2017.3.2. What IntelliJ version do you use?Galenical
Was using 2017.1.x. I could see some gradle project sync time reduced with 2017.3.4. You can post it as an answer so I can mark it.Roderic
This is not fixed in idea 17.3.4 and 18.2. It seems like forever problem with intellij idea. It wold be great to see comments how to troubleshoot problems alike with VisualVM. If you know how, please let me know.Indebted
It looks like after some timeouts expired idea comes back to conscious state. But for me a theory of timeouts on IPv6 lookups intellij-support.jetbrains.com/hc/en-us/community/posts/… doesn't work yet(Indebted
G
0

YourKit has special product to profile Grable builds https://www.yourkit.com/projectx/eap/ It is available in EAP and it might help to understand what Gragle does under the hood.

Gizmo answered 31/1, 2018 at 12:49 Comment(1)
OP said, "I profiled gradle process using YourKit Profiler, but not able to pin point and solve why it is taking so long." Perhaps you should work with him to identify the problem instead of pitching your product.Pentagram

© 2022 - 2024 — McMap. All rights reserved.