How do I increase memory on Tomcat 7 when running as a Windows Service?

前端 未结 6 2194
無奈伤痛
無奈伤痛 2020-12-01 05:09

I am trying to run Tomcat 7 as a Windows Service (XP and Windows 7).

I see places to set the -Xmx and -Xms jvm args in catalina.bat, but I\'m not sure how to do it w

相关标签:
6条回答
  • 2020-12-01 05:42

    For Tomcat 7 to increase memory :

    Identify your service name, you will find it in the service properties, under the "Path to executable" at the end of the line

    For me it is //RS//Tomcat70 so the name is Tomcat70

    Then write as administrator :

    tomcat7.exe //US//Tomcat70 --JvmOptions=-Xmx1024M
    
    0 讨论(0)
  • 2020-12-01 05:46

    If you are running a custom named service, you should see two executables in your Tomcat/bin directory
    In my case with Tomcat 8

    08/14/2019  10:24 PM           116,648 Tomcat-Custom.exe
    08/14/2019  10:24 PM           119,720 Tomcat-Customw.exe
                   2 File(s)        236,368 bytes
    

    Running the "w" terminated executable will let you configure Xmx in the Java tab

    0 讨论(0)
  • 2020-12-01 05:52

    According to catalina.sh customizations should always go into your own setenv.sh (or setenv.bat respectively) eg:

    CATALINA_OPTS='-Xms512m -Xmx1024m'
    

    My guess is that setenv.bat will also be called when starting a service.I might be wrong, though, since I'm not a windows user.

    0 讨论(0)
  • 2020-12-01 05:56

    Assuming that you've downloaded and installed Tomcat as Windows Service Installer exe file from the Tomcat homepage, then check the Apache feather icon in the systray (or when absent, run Monitor Tomcat from the start menu). Doubleclick the feather icon and go to the Java tab. There you can configure the memory.

    enter image description here

    Restart the service to let the changes take effect.

    0 讨论(0)
  • 2020-12-01 05:58

    //ES/tomcat -> This may not work if you have changed the service name during the installation.

    Either run the command without any service name

    .\bin\tomcat7w.exe //ES
    

    or with exact service name

    .\bin\tomcat7w.exe //ES/YourServiceName
    
    0 讨论(0)
  • 2020-12-01 06:03

    The answer to my own question is, I think, to use tomcat7.exe:

    cd $CATALINA_HOME
    .\bin\service.bat install tomcat
    .\bin\tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 --JvmSs=1024
    

    Also, you can launch the UI tool mentioned by BalusC without the system tray or using the installer with tomcat7w.exe

    .\bin\tomcat7w.exe //ES//tomcat
    

    An additional note to this:

    Setting the --JvmXX parameters (through the UI tool or the command line) may not be enough. You may also need to specify the JVM memory values explicitly. From the command line it may look like this:

    bin\tomcat7w.exe //US//tomcat7 --JavaOptions=-Xmx=1024;-Xms=512;..
    

    Be careful not to override the other JavaOption values. You can try updating bin\service.bat or use the UI tool and append the java options (separate each value with a new line).

    0 讨论(0)
提交回复
热议问题