General guidelines for improving Bamboo Data Center Elastic Agent startup times
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
As a baseline, a Bamboo Elastic Agent running on the Stock Linux AMI on an m5.large takes about 2 minutes to start and connect to the Bamboo server. If it is taking much longer than that, here are some general guidelines for improving it.
Due to the operating system's requirements, Windows Elastic Agents take longer to start than Linux Elastic Agents. Please follow the feature request below for updates about the implementation of a faster startup sequence for Elastic Agents on Windows.
Solution
Instance type
Use an EC2 Instance Type which has more compute and compare the startup time to see if it improves by much. Avoid instance types with 1 vCPU such as m3.medium
. Moving from a m3.medium
to a m3.large
improved start-up times from 10 minutes to 3 minutes.
Increase heap memory for the agent
If you are using third-party applications, some may need more memory to initialize properly. For example, Artifactory for Bamboo requires more memory than the default heap configuration allows, which can lead to excessive garbage collection (GC) and extended startup times. To address this, you can increase the heap size of the Elastic Agent from the default of either 256 MB or 512 MB (depending on the Bamboo version) to 1024 MB or more.
Note that this will reserve more total memory for the Agent Java process, which means less memory will be available for build processes and the operating system. Balance this accordingly with total system resources.
Custom AMI snapshot
If using a custom AMI, ensure the snapshot of the AMI is taken after the Agent has connected for the first time so that jar files dependency caches are populated.
Remove unneeded apps
Remove any unneeded third-party apps/plugins from the Bamboo Administration >> Manage apps as each app must be synced to the Agent and initialized.
Startup script
Optimize your Instance startup script if you have one configured at Bamboo Administration >> Image Configurations >> Edit >> Instance startup script as a long-running script can prolong agent start