Agent Memory Usage

I have a problem trying to limit the agent's memory usage.
As far as I can say, you can limit the memory usage by setting the parameter TEAMCITY_AGENT_MEM_OPTS in the agent's startup script like ''.
I have set it to: TEAMCITY_AGENT_MEM_OPTS="-Xms128m -Xmx256m"
Unfortunately it looks like the agent is ignoring the parameters and I wonder how this is possible, because I thought the parameters define the limitation of the used VM. As I can see the agent is using 680MB, starting with a usage of 180 and increasing the usage until 680.
Under the circumstances the memory usage is limited to 1GB and and it's not possible to start any build configuration at all, because the agent wants to address some more memory to fullfill it's job.
First of all I wonder how the agent is able to grab more memory then I told it to. Second I wonder why the agent adresses additional memory, starting a build configuration.
Neverthless it looks like we got some minimum requirements I can't fullfill with my server and I wonder why...
I can start a tomcat with restricted requirements like 128MB but no build agent... hm... strange...


Comment actions Permalink

You should not modify, instead you should define environment variable TEAMCITY_AGENT_MEM_OPTS with appropriate arguments. BTW are you sure memory eaten by the agent process? Could it be the process where the build is running?

Agent is working in the JVM, when Java based build is started a new JVM is created and build is running in this JVM. This JVM has memory settings defined in the corresponding build configuration. Could you please attach here output of ps -axf command launched on your agent?

Comment actions Permalink

The build is using a sepparate VM, that's why the memory usage increases when starting a build.
But neverthless the main problem to restrict the memory for the agent is not solved yet.

This is the memory usage before I start the agent:

             total       used       free     shared    buffers     cached
Mem:          1024        122        901          0          0          0
-/+ buffers/cache:        122        901
Swap:            0          0          0

After starting the agent it looks like this:

             total       used       free     shared    buffers     cached
Mem:          1024        798        225          0          0          0
-/+ buffers/cache:        798        225
Swap:            0          0          0

I identified two processes started by the agent:

19080 pts/0    Sl     0:00 /usr/bin/java -ea -cp ../launcher/lib/launcher.jar jetbrains.buildServer.agent.Launcher -ea -Xms128m -Xmx256m
19091 pts/0    Sl     0:22  \_ /usr/lib/j2sdk1.5-sun/jre/bin/java -ea -Xms128m -Xmx256m -Dteamcity_logs=../logs/ -Dlog4j.configuration=f

The memory usage of the two process look like this (using top):

19080 tomcat    20   0  229m  15m 7964 S    0  1.5   0:00.36 java
19091 tomcat    20   0  559m 163m 124m S    0 16.0   0:22.53 java

As you can see the second process is consuming lots of memory.

Thanx in advance.


Please sign in to leave a comment.