How to reduce memory footprint

Hi, I've been playing with the latest 8.0 EAP. I have set up the server on an amazon EC2 tiny instance and the agent is an on-demand amazon ec2 small instance. The installation is small - There are probably 2 or 3 projects and they get built once a day. The problem I have is that the server is really too big for the tiny instance. I have it running by changing the xmx java setting to 128m and I have given the server 256m of swap space. Still though, the java process ends up using about 800 meg of memory which is insane given what it is doing (not much).
My guess is that it is partially caused by loading all the plugins. I only need a very small sub-set of them but there does not seem to be a way to disable them from the UI.

So, my question is, what's the best practice for running as small a server as possible so that it can fit on an amazon micro instance easily? Anyone have good numbers for the max memory to pass to java? I am running a 32 bit machine with oracle 7 java. 128 meg max heap seems fine. What should max perm size be set to? Why is java using so much memory - is it the plugins. If so, how do I remove the ones that I don't need?



Comment actions Permalink

I guess most of this memory is used by permgenspace which contains loaded classes. So your guess about plugins can be correct. BTW, what memory usage is shown on diagnostics page for the server?

Comment actions Permalink

The memory usage is: Current memory usage: 127.82 MB (51.6% of maximum available memory: 247.50 MB).
which you would think would be ok given the machine has about 670 available ... but it's not, I need to allocate swap space to bring it up to about 1.3 Gb.
It looks like the memory ramps up when you first start the TC server until it blows up when you get to the login screen. Once it is all initialised, the memory seems to drop back to something sensible.

I wonder if tomcat is to blame and whether I should try something like jetty which is meant to be smaller.
Also, if I want to remove the plugins that I don't need, how do I do that? Can I just delete the directories in the plugins directory? Are there dependencies between them that I need to be aware of?

This is the JVM arguments:

-Djava.util.logging.config.file=/home/ec2-user/TeamCity/conf/ -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx256m -XX:MaxPermSize=128m -Dlog4j.configuration=file:/home/ec2-user/TeamCity/bin/../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/ -Djava.awt.headless=true -Djava.endorsed.dirs=/home/ec2-user/TeamCity/endorsed -Dcatalina.base=/home/ec2-user/TeamCity -Dcatalina.home=/home/ec2-user/TeamCity 

Just for interest, the server configuration is as follows:

Server Configuration

Platform Linux 3.4.37-40.44.amzn1.i686 i386
Login modules Built-in
HTTP authentication schemes Basic HTTP
Database version MySQL 5.5
JDBC driver version MySQL-AB JDBC Driver 5.1
Java version 1.6.0_24
Java runtime version 1.6.0_24-b24
Maximum used memory 247Mb
License type Enterprise
Server version 8.0 EAP
Server build


Comment actions Permalink

You can try to remove plugin directories and / or zip files from WEB-INF/plugins directory. Plugins with <deployment use-separate-classloader="true"/> in their teamcity-plugin.xml can be safely removed. As to others - you can try and see how server behaves.


Please sign in to leave a comment.