Core Java

Java: How to Slash Down Building Times Using the Cloud

Building larger Java projects on a laptop with Maven can be frustrating and slow. Learn how you could slash down building times by building in the cloud instead.

Setup

As a founder of open-source Speedment Stream ORM, I usually build the project several times per day on my now somewhat old laptop (Macbook Pro, Mid 2015). The Speedment project consists of over 60 modules and the build process is managed by Maven. The project lives
here on Github.

I wanted to find out if I could save time by building the project in the cloud instead. In this short article, I will share my results. I have compared my laptop with Oracle Cloud, running the same build process.

I am using the following setup:

 LaptopOracle Cloud
Java JDKOracleJDK 1.8.0_191OracleJDK 1.8.0_201
Maven Version3.6.03.5.4
CPU Cores44
CPU Type2.2 GHz Intel Core i72.0 GHz Intel Xeon Platinum 8167M
RAM30G16G

I should mention that we also have continuous integration servers that run in the cloud using Jenkins.

Laptop

01
02
03
04
05
06
07
08
09
10
11
12
13
Pers-MBP:speedment pemi$ time mvn clean install
 
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  07:46 min
[INFO] Finished at: 2019-04-09T15:34:25+02:00
[INFO] ------------------------------------------------------------------------
 
real 7m48.065s
user 12m33.850s
sys 0m50.476s

Oracle Cloud

01
02
03
04
05
06
07
08
09
10
11
12
13
[opc@instance-20190409-xxxx speedment]$ time mvn clean install
 
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:41 min
[INFO] Finished at: 2019-04-09T13:30:20Z
[INFO] ------------------------------------------------------------------------
 
real 3m42.602s
user 10m22.353s
sys 0m32.967s

Parallel Builds

Running parallel builds reduce building time:

01
02
03
04
05
06
07
08
09
10
11
12
Pers-MBP:speedment pemi$ time mvn -T 4 clean install
 
real 4m47.629s
user 14m24.607s
sys 0m56.834s
 
 
[opc@instance-20190409-xxxx speedment]$ time mvn -T 4 clean install
 
real 3m21.731s
user 11m15.436s
sys 0m34.000s

Summary

The following graph shows a comparison for sequential Speedment Maven builds on my laptop vs. Oracle Cloud (lower is better):

The next graph shows a comparison for parallel builds (lower is better):

The conclusion is that sequential build time was reduced by over 50% when I used the cloud solution and the parallel build time was reduced by 30%.

If I re-build completely two times a day, this means I will save 2 hours per month. More importantly, I will get feedback faster so I could stay “in the development flow”.

As a final word, it should be noted that there are other complementary ways of reducing building times including selecting appropriate maven and JVM parameters, only build changed modules and running the build under GraalVM.

Resources

Speedment Open Source: https://github.com/speedment/speedment

Oracle Cloud: https://cloud.oracle.com/home

Published on Java Code Geeks with permission by Per Minborg, partner at our JCG program. See the original article here: Java: How to Slash Down Building Times Using the Cloud

Opinions expressed by Java Code Geeks contributors are their own.

Per Minborg

I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button