Various aspects of TeamCity behavior can be customized through a set options passed on TeamCity server or agent start. These options fall into two categories: affecting Java Virtual Machine (JVM) and affecting TeamCity behavior. You do not need to specify any of the options unless you are advised to do by TeamCity support team or you are know what you are doing.
Server Startup Properties
TeamCity internal properties
TeamCity has some properties that are not exposed to UI and are meant for debug use only. If you need to set such a property (e.g. by TeamCity support), you can set it either as -D<name>=<value> JVM property (see below), or since TeamCity 5.1 you can add TeamCity-related properties in <TeamCity Data Directory>/config/internal.properties file. The file is Java properties file.
JVM Properties
If you need to pass additional JVM options to a TeamCity server (e.g. -D options mentioned at Reporting Issues or any non-"-D" options like -X...), the approach will depend on the way the server is run. If you run the server using Windows service, please refer to TeamCity-Server-is-Run-as-Windows-Service, if you are using .war distribution, use the manual of your Web Application Server. In all other cases, please refer to Server-is-Run-Via-Shell-Script.
To change heap memory dedicated to the JVM change the "Maximum memory pool" setting.
Agent Startup Properties
In TeamCity a build agent contains two processes:
Agent Launcher — Java process that launch the agent process itself
Agent — main process for a Build Agent; runs as a child process for the agent launcher
Whether you run a build agent via the agent.bat|sh script or as a Windows service, at first the agent launcher starts and then it starts the agent. For both processes you can customize the final agent behavior by specifying system properties and variables to run with.
Agent Launcher Properties
Build Agent Is Run Via Script
Before you run the <Agent Home>\bin\agent.bat|sh script, set the TEAMCITY_LAUNCHER_OPTS environment variable.
Build Agent Is Run As Service
In the <Agent Home>\launcher\conf\wrapper.conf file, add the following lines (one per option, the N number should increase):
wrapper.java.additional.<N>
note
Please ensure to re-number all the lines after the inserted ones.
Agent Properties
Build Agent Is Run Via Script
Before you run the <Agent Home>\bin\agent.bat|sh script, set the following environment variables:
TEAMCITY_AGENT_MEM_OPTS — Set agent memory options (JVM options)