Is Gradle slower on Linux?

I have an empty gradle project, with just the gradle wrapper setup in it. On a Centos 6.3 virtual machine in VirtualBox, with the gradle daemon running, it takes ~15-18 seconds to run ‘gradle tasks’. The same exact project in my Windows host takes ~1 second to run ‘gradle tasks’.

Is Linux performance a known issue? Or is it possibly just my setup that is being slow? I have not had Linux virtual machines (Debian) be slow before, but using Centos and Gradle is new to me, so I’m trying to narrow down which is the issue.

On the Centos: How are you setting Gradle into daemon mode? How are you confirming that the daemon is staying up between runs?

Hello Peter, thank you for responding.

I am setting gradle into daemon mode using the gradle.properties:

org.gradle.daemon=true

And there are two ways that I confirm that the daemon must be running:

$ ps -ef | grep gradle
mbelling
 614 32714
0 14:05 pts/0
  00:00:00 grep gradle
mbelling 32144
   1
5 12:52 ?
      00:03:43 /usr/java/jdk1.7.0_10/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -cp /home/mbelling/.gradle/wrapper/dists/gradle-1.3-bin/6duudkdtsf89ftu9dh8bpgenv0/gradle-1.3/lib/gradle-launcher-1.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.3 /home/mbelling/.gradle/daemon 10800000 e622729c-2f93-4b32-9ace-4f858266e4e2 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8

The other way is to run without the gradle daemon and it takes longer:

With daemon running:

$ gradle tasks
... stuff ...
BUILD SUCCESSFUL
  Total time: 15.728 secs

Without daemon running:

$ gradle tasks --no-daemon
... stuff ...
BUILD SUCCESSFUL
  Total time: 40.452 secs

Can you try using the fully qualified path to the Gradle binary?

I want to isolate some kind of PATH issue on that platform.

I originally ‘installed’ the unzipped gradle to /opt/gradle-1.3.

I then set up the build.gradle and used the gradle wrapper command to place the proper things in my project for gradle wrapper.

$ /opt/gradle-1.3/bin/gradle tasks
... stuff ...
Total time: 15.07 secs

Using gradlew command:

$ ./gradlew tasks
... stuff ...
Total time: 14.498 secs

Direct path to the gradle the gradlew uses:

$ /home/mbelling/.gradle/wrapper/dists/gradle-1.3-bin/6duudkdtsf89ftu9dh8bpgenv0/gradle-1.3/bin/gradle tasks
... stuff ...
Total time: 18.065 secs

My last comment used just ‘gradle’, which is the /opt/gradle-1.3/bin/gradle which is in my PATH.

I cloned my repository to a Debian virtual machine I have, and gradle is lightning fast there. I think I’m just going to chalk this up to a poor VM setup.

OK - I’ll close this out.

Thank you for your time.

For what it is worth, I discovered the reason for the slowness on the virtual machine. I used the default motherboard chipset in Virtualbox of “PIIX3”. Apparently there are general I/O issues with Red Hat distributions and that chipset in Virtualbox, and switching the chipset to “ICH9” got rid of the slowness.

I am using CentOS through virtualbox. However, I use SATA AHCI and I don’t see bad performance for anything else.