When the AWS CodeBuild was loading the maven repos from https://repo1.maven.org/maven2 the build time would be around 60secs (this is the time to download the Jars, build and run the tests).
But after updating the maven repos to load from AWS CodeArtifact services (i.e I created a repository in AWS CodeArtifact to connect to Maven central repository) the build time has been consistently above 200 seconds.
Should the build time now not be lesser because one AWS service (AWS CodeBuild) is communicating with another AWS service (AWS CodeArtifact) all in the same region. So they would be using the AWS network right?
Can someone share some inputs on the increased build times?
Update: Adding the maven dependencies below:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<apache-commons.version>2.6</apache-commons.version>
<java.version>11</java.version>
<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.4.1</thymeleaf-layout-dialect.version>
<thymeleaf-extras-java8time.version>3.0.3.RELEASE</thymeleaf-extras-java8time.version>
<mybatis-starter.version>2.1.1</mybatis-starter.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-starter.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-resource-server</artifactId>
</dependency>
<!-- AWS -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</dependency>
<dependency>
<artifactId>aws-java-sdk-s3</artifactId>
<groupId>com.amazonaws</groupId>
</dependency>
<!-- End of AWS -->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-json -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${apache-commons.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>${mybatis-starter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.10.42</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.700</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Sample CodeBuild log while downloading the dependencies:
[INFO] Scanning for projects...
Downloading from codeartifact: https://<domain>.d.codeartifact.<region>.amazonaws.com/maven/maven/software/amazon/awssdk/bom/2.9.16/bom-2.9.16.pom
Progress (1): 4.1/47 kB
Progress (1): 8.2/47 kB
Progress (1): 12/47 kB
Progress (1): 16/47 kB
Progress (1): 20/47 kB
Progress (1): 25/47 kB
Progress (1): 29/47 kB
Progress (1): 33/47 kB
Progress (1): 35/47 kB
Progress (1): 39/47 kB
Progress (1): 43/47 kB
Progress (1): 47 kB
Downloaded from codeartifact: https://<domain>.d.codeartifact.<region>.amazonaws.com/maven/maven/software/amazon/awssdk/bom/2.9.16/bom-2.9.16.pom (47 kB at 46 kB/s)
Downloading from codeartifact: https://<domain>.d.codeartifact.<region>.amazonaws.com/maven/maven/software/amazon/awssdk/aws-sdk-java-pom/2.9.16/aws-sdk-java-pom-2.9.16.pom
Progress (1): 4.1/57 kB
Progress (1): 8.2/57 kB
Progress (1): 12/57 kB
Progress (1): 16/57 kB
Progress (1): 20/57 kB
Progress (1): 25/57 kB
Progress (1): 29/57 kB
Progress (1): 33/57 kB
Progress (1): 37/57 kB
Progress (1): 41/57 kB
Progress (1): 44/57 kB
Progress (1): 48/57 kB
Progress (1): 52/57 kB
Progress (1): 56/57 kB
Progress (1): 57 kB
Downloaded from codeartifact: https://<domain>.d.codeartifact.<region>.amazonaws.com/maven/maven/software/amazon/awssdk/aws-sdk-java-pom/2.9.16/aws-sdk-java-pom-2.9.16.pom (57 kB at 118 kB/s)
Downloading from codeartifact: https://<domain>.d.codeartifact.<region>.amazonaws.com/maven/maven/com/amazonaws/aws-java-sdk-bom/1.11.657/aws-java-sdk-bom-1.11.657.pom
Progress (1): 4.1/41 kB
Progress (1): 8.2/41 kB
Progress (1): 12/41 kB
Progress (1): 16/41 kB
Progress (1): 20/41 kB
Progress (1): 25/41 kB
Progress (1): 29/41 kB
Progress (1): 33/41 kB
Progress (1): 35/41 kB
Progress (1): 39/41 kB
Progress (1): 41 kB
The Maven central repository is served from a CDN optimized for public read access. Private CodeArtifact repositories include features such as AWS authentication, asset encryption, upstream repositories and external connections that influence the time for each request.
The AWS CodeArtifact team is aware that performance is not what you (or we) would like it to be, particularly for Maven. Thank you for providing your set of dependencies so we can use them to baseline and measure our performance improvement efforts. We plan to improve this next year. In the meantime have you looked into Enabling Caching for AWS CodeBuild?