TeamCity how to set JVM Arguments

11,355

Solution 1

I would recommend adding the JVM memory options in the startup script (start.sh) for server based startup using the variable TEAMCITY_SERVER_MEM_OPTS . Please do not set it in the profile of the userid that runs teamcity.

This link should be helpful to you.

In case you want different memory settings for server and agent(usually that's the case), please be selective in naming the variables so that there is a difference in identifying the JVM options for server and agent startup.

As a rule of thumb for teamcity setups, I normally let my teamcity server have 20% more memory than my avg usage to account for any increased load during peak usage periods.

Solution 2

For the record, Igor's answer is wrong. Not sure why it was upvoted. I cannot comment or down vote because my rep numbers are low. However, internal properties are read after the JVM is started and so the heap settings will not take effect if put there. I was looking into how to do this for a TeamCity container. Best option seems to be to use environment variables (TEAMCITY_SERVER_MEM_OPTS). For a container, those can be set by passing -e TEAMCITY_SERVER_MEM_OPTS='...' when creating the container.

Solution 3

In TC9+ it is possible to set this variable in TC Server GUI: Administration -> Diagnostics -> Internal Properties -> Edit internal properties

For 64-bit JVM the recommended setting is:

TEAMCITY_SERVER_MEM_OPTS=-Xmx4g -XX:MaxPermSize=270m -XX:ReservedCodeCacheSize=350m

Just add this line to the Internal properties edit box

Share:
11,355
SLimke
Author by

SLimke

Updated on July 27, 2022

Comments