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:
Laptop | Oracle Cloud | |
Java JDK | OracleJDK 1.8.0_191 | OracleJDK 1.8.0_201 |
Maven Version | 3.6.0 | 3.5.4 |
CPU Cores | 4 | 4 |
CPU Type | 2.2 GHz Intel Core i7 | 2.0 GHz Intel Xeon Platinum 8167M |
RAM | 30G | 16G |
I should mention that we also have continuous integration servers that run in the cloud using Jenkins.
Laptop
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
[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: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/speedmentOracle Cloud: https://cloud.oracle.com/home
Stop putting unrelated commercial messages on my blog. Shame on you.
ReplyDelete