Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run TeamCity on 64-bit JVM

I've just found out that TeamCity runs on the 32-bit JVM on Windows, for some reason.

I'm seeing memory errors logged when checking out a large (not that large) Git repo and am already at the max heap size for the JVM. I know nothing about Java or the JVM, or TomCat.

How can I run TeamCity on a modern, 64-bit JVM? I sense its going to be a pain, else it would be the default.

We're a tiny team and if something doesn't have Apple levels of 'it just works' then we skip it.

We can live with this one project not be on the CI server, but it would be nice to know what's involved and weigh up the investment.

Any advice appreciated.

Edit

Okay so Markus pointed to this snippet (which I had read), but I can't see any information there explaining what to do.

Using 64 bit Java to Run TeamCity Server TeamCity can run under both 32 and 64 bit JVM. It is recommended to use 32 bit JVM unless you need to dedicate more than 1.3Gb of memory to the TeamCity process.

If you choose to use x64 JVM please note that the memory usage is almost doubled when switching from 32 to 64 bit JVM, so please make sure you specify at least twice as much memory as for 32 bit JVM, see Setting Up Memory settings for TeamCity Server.

If you run TeamCity as a service and switch to x64 bit, you will also need to use x64 Tomcat executables, see more.

Did I miss something?

Edit 2

Ah, okay, buried in some paragraphs above that link is this:

"if you run as Windows service and want to upgrade JRE to 64 bit version, you will need to replace \jre with appropriate JRE"

So I guess I need to copy some files into the /jre folder?

like image 311
Luke Puplett Avatar asked Nov 08 '13 17:11

Luke Puplett


People also ask

Does TeamCity run on Java?

TeamCity Agent is a standalone Java application. It requires a Java SE JRE installation to run. See notes on how to configure Java on agents.

How do I run TeamCity locally?

Install and run on WindowsRun the downloaded .exe file and follow the instructions of the TeamCity Setup wizard. The TeamCity web server and one build agent will be installed on the same machine. During the installation, you can: set the TeamCity Home Directory where TeamCity will be installed.

How much RAM does TeamCity use?

about 4 MB log per build.

How do I change my TeamCity port?

Changing Server Port To change the port of the installed/unpacked server, open the <TeamCity Home Directory>/conf/server. xml file and set another number in the not commented <Connector> XML node: <Connector port="8111" ... To apply the changes, restart the server by.


3 Answers

The way I made it work (TeamCity 8, Windows server 2008 r2):

  • Install the 64-bit JRE on the target machine, now there are two ways to do this

  • A -> If you are using the Teamcity bundled JRE, replace the JRE folder ([TC Server folder]\JRE) with the JRE folder in the newly installed JRE x64 - You have to shut down the TC server service (along with all java.exe*32 services that might also use this JRE)

  • B -> Change the TeamCity Internal properties, to point to newly installed JRE x64 (see documentation for TC version 8, TC version 9 can be found here):

    java.home=C\:\\<JRE x64 install folder>\\jre
    java.ext.dirs=C\:\\<JRE x64 install folder>\\jre\\lib\\ext\;C\:\\Windows\\Sun\\Java\\lib\\ext 
    java.library.path=C\:\\<JRE x64 install folder>\\jre\\bin\;C\:\\Windows\\Sun\\Java\\bin\;C\:\\Windows\\system32\;C\:\\Windows\;C\:\\local\\Oracle\\clients\\112_64\\bin\;C\:\\local\\Oracle… 
    
  • An alternative to point B would be to change Environment variable JAVA_HOME, it`s more simple, but it requires a Windows server restart after that

  • If you run the TC Server service now, it should run as a 64-bit Java process (chceck via PID in task manager) :

Resource  MonitorTask Manager

  • Don`t be alarmed if the server does not start up throwing an error :

     Error: SQL error when doing: Connecting to MSSQL: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property 
    
  • Download JTDS - 1.3.1 (http://sourceforge.net/projects/jtds/files/jtds/1.3.1/) and install it

  • Take the ntlmauth.dll file from [JTDS-1.3.1 install folder]/x64/SSO folder and replace the one in [TC Server folder]\bin

  • The TC server should now run fine as 64 bit Java process

  • You can increase the memory allocation (as that is the whole point of the upgrade) now on the server as described here : https://confluence.jetbrains.com/display/TCD8/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-SettingUpMemorysettingsforTeamCityServer

like image 131
Martin Basista Avatar answered Sep 28 '22 16:09

Martin Basista


The snippet from the updated question had a link in the original, pointing to the instructions on Java update for TeamCity server in TeamCity online doc.

Basically, the instructions vary based on the TeamCity distribution used and way of launching the server.

If your intent is to increase the memory for the TeamCity server, please make sure to read through the corresponding section on the same doc page.

Yet one more note: recent TeamCity versions perform Git fetch in a separate process and Git-related memory issues during fetch might require fine-tuning of the corresponding options.

like image 29
Yaegor Avatar answered Sep 28 '22 18:09

Yaegor


"So I guess I need to copy some files into the /jre folder?"

No. You install a 64 bit JRE, and update the relevant setting to point at the 64-bit install's JRE.

Don't copy stuff from one JRE installation into another. You will break things!

like image 31
Stephen C Avatar answered Sep 28 '22 16:09

Stephen C