Details
-
Suggestion
-
Resolution: Fixed
-
None
-
0
-
5
-
Description
Summary
It would be nice to have the ability to change the heap size of the elastic agents running on Windows images.
Environment
An elastic agent is an agent that runs in the Amazon Elastic Compute Cloud (EC2). An elastic agent process runs in an elastic instance of an elastic image.
Notes
It is currently not possible to adjust the amount of memory allocated to the elastic agents from within the Bamboo GUI. For elastic agents running on Unix-based images there's a workaround available here. However, the workaround described in that page does not work for elastic agents running on Windows.
Workaround
Set the following into the instance start-up script for the image:
Option 1:
Requires sed to be installed in the image which is included in our stock images but may not existing in a custom AMI.
sed -i "s/-Dimagefiles/-Dbamboo.agent.syncOnly -Dimagefiles/" C:\opt\bamboo-elastic-agent\bin\bamboo-elastic-agent.bat sed -i 's@cd %%OLD_PWD%%@sed -i \'s/-Xmx256m/-Xmx512m/\' \%%TEMP\%%\\\\bamboo-agent-bootstrap-1.bat\n\%%TEMP\%%\\\\bamboo-agent-bootstrap-1.bat ^>^>bamboo-elastic-agent.out 2^>\^&1\ncd %%OLD_PWD%%@' C:\opt\bamboo-elastic-agent\bin\bamboo-elastic-agent.bat
Option 2:
setx -m _JAVA_OPTIONS "-Xms256m -Xmx512m"
This is a global Java variable, so any java processes that run during your builds (e.g. Gradle and Maven) will also inherit this config for their respective JVMs.