|
From: Michael M. <mr...@vm...> - 2012-10-21 14:28:09
|
>From: Leif Mortensom >If you require more complicated memory configurations, this can be done >using the wrapper.java.additional.<n> properties as follows: > >wrapper.java.additional.1=-Xms3m >wrapper.java.additional.2=-Xmx64m > >Additional memory settings can be added as needed. When you are done, I >recommend setting the following property the first time you launch the JVM >so you can double check the command line. >wrapper.java.command.loglevel=INFO > >Please let me know if you have any questions getting up and running. Thanks for the response Leif. Guess I wasn't clear either, in our system the memory size values are dynamic, may change each time the jvm is started. I didn't want to modify the wrapper.conf each time the app starts so wanted to know if I could pass the values in to tanuki via env var or cmd line. Mike |
|
From: Leif M. <lei...@ta...> - 2012-10-22 07:44:54
|
Michael, There are a number of ways to pass values into the Wrapper to do what you want. The method you use will depend on the circumstances under which you will be changing the memory size settings. 1) Environment variables. http://wrapper.tanukisoftware.com/doc/english/props-envvars.html It is possible to reference any environment variable from within your wrapper.conf file. These values of course will only work when the environment is loaded. This means that if you change the environment (SYSTEM in most cases) you will need to restart the Wrapper service itself for the changes to take affect. If you use environment variables, you do so as follows: Environment: --- JAVA_MAX_MEMORY=256 --- wrapper.conf: --- wrapper.java.additional.2=-Xmx%JAVA_MAX_MEMORY%m --- 2) Command line. http://wrapper.tanukisoftware.com/doc/english/props-command-line.html When you install the Wrapper as a service, it is possible to specify any wrapper property on its command line. This method can only be used when either installing as a service, or updating the Service configuration. The install command would look like this: --- wrapper.exe -i ..\conf\wrapper.conf wrapper.java.additional.2=-Xmx64m --- 3) Cascading Configuration Files. http://wrapper.tanukisoftware.com/doc/english/props-cascading.html It is possible to dynamically create a small configuration file which only contains the properties that you want to change, and then include that from your main configuration file. This method will work if you restart the Wrapper, or even just the JVM if you have the wrapper.restart.reload_configuration=TRUE property set. http://wrapper.tanukisoftware.com/doc/english/prop-restart-reload-configuration.html Please let me know if you have any questions about any of these. Cheers, Leif On Sun, Oct 21, 2012 at 11:27 PM, Michael MacFaden <mr...@vm...> wrote: > >From: Leif Mortensom > >If you require more complicated memory configurations, this can be done > >using the wrapper.java.additional.<n> properties as follows: > > > >wrapper.java.additional.1=-Xms3m > >wrapper.java.additional.2=-Xmx64m > > > >Additional memory settings can be added as needed. When you are done, I > >recommend setting the following property the first time you launch the JVM > >so you can double check the command line. > >wrapper.java.command.loglevel=INFO > > > >Please let me know if you have any questions getting up and running. > > Thanks for the response Leif. Guess I wasn't clear either, in our > system the memory size values are dynamic, may change each time the > jvm is started. I didn't want to modify the wrapper.conf each time > the app starts so wanted to know if I could pass the values in > to tanuki via env var or cmd line. > > Mike > |
|
From: Michael M. <mr...@vm...> - 2012-10-24 22:21:04
|
Thanks Leif, quite helpful. So here's what I have now. c:\type myapp-startup.bat .... rem The base name for the Wrapper binary. set _WRAPPER_BASE=vws-wrapper rem The name and location of the Wrapper configuration file. This will be used rem if the user does not specify a configuration file as the first argument to rem this script. set _WRAPPER_CONF_DEFAULT=../conf/vws-wrapper.conf rem Note that it is only possible to pass parameters through to the JVM when rem installing the service, or when running in a console. # setup VM's memory settings, variables picked up by ../conf/vww-wrapper.conf # see https://wiki.eng.vmware.com/CloudVM/Sizing # APP_NAME must match entry in vws-wrapper.conf set APP_NAME=vmware-vws if not defined VMWARE_JAVA_HOME exit 2 if not defined VMWARE_CLOUDVM_RAM_SIZE exit 3 if not defined VMWARE_LOG_DIR exit 4 set JAVA_HOME=%VMWARE_JAVA_HOME% set /a MAXMEM_VALUE=0 set /a MINMEM_VALUE=0 set /a VAR=0 set size_cmd='"%VMWARE_CLOUDVM_RAM_SIZE%" %APP_NAME%' for /f %%A in (%size_cmd%) do ( set /a VAR=%%A ) set /a MAXMEM_VALUE += %VAR% if %MAXMEM_VALUE == 0 exit 5 if %MINMEM_VALUE% == 0 set MINMEM_VALUE=16 echo "'%APP_NAME%' is using a starting heap of %MINMEM_VALUE% and a max of %MAXMEM_VALUE% mb rem Do not modify anything beyond this point rem --------------------------------------------------- .... BTW, this warning was helpful was well since the design we were toying with internally was not placing wrapper.java.command=c:\some-wrapper-that-calls-java\script.bat And was seeing this: DEBUG | wrapper | 2012/10/24 14:35:51 | Waiting 5 seconds before launching another JVM. DEBUG | wrapper | 2012/10/24 14:35:56 | Magic number for file vmware-vws.bat: 0x4072656d WARN | wrapper | 2012/10/24 14:35:56 | The value of wrapper.java.command does not appear to be a java binary. WARN | wrapper | 2012/10/24 14:35:56 | The use of scripts is not supported. Trying to continue, but some features may not work correctly.. Mike MacFaden Staff Engineer, VMware , Palo Alto CA ----- Original Message ----- > Michael, > There are a number of ways to pass values into the Wrapper to do what > you want. The method you use will depend on the circumstances under > which you will be changing the memory size settings. > 1) Environment variables. > http://wrapper.tanukisoftware.com/doc/english/props-envvars.html > It is possible to reference any environment variable from within your > wrapper.conf file. These values of course will only work when the > environment is loaded. This means that if you change the environment > (SYSTEM in most cases) you will need to restart the Wrapper service > itself for the changes to take affect. If you use environment > variables, you do so as follows: > Environment: |
|
From: Leif M. <lei...@ta...> - 2012-10-29 05:57:49
|
Michael, The Warning you are seeing when you replace java.exe with a bat file is intentional. We used to be more flexible there but had a few users who were doing something similar to you and running into problems. The Wrapper expects that it is launching java directly and then monitors that process until it exits. When a bat or sh file is used, they sometimes will launch the JVM in the background and then exit. This was causing the Wrapper to think the JVM exited and for it to be restarted. If it is necessary to take actions before launching a JVM, then we recommend using the jvm_prelaunch event to execute a command before the Wrapper launches the JVM. http://wrapper.tanukisoftware.com/doc/english/props-event.html It sounds like you have everything working. Let me know if we can be of further assistance Cheers, Leif On Thu, Oct 25, 2012 at 7:20 AM, Michael MacFaden <mr...@vm...> wrote: > Thanks Leif, quite helpful. > > > So here's what I have now. > > > c:\type myapp-startup.bat > > .... > rem The base name for the Wrapper binary. > set _WRAPPER_BASE=vws-wrapper > > rem The name and location of the Wrapper configuration file. This will > be used > rem if the user does not specify a configuration file as the first > argument to > rem this script. > set _WRAPPER_CONF_DEFAULT=../conf/vws-wrapper.conf > > rem Note that it is only possible to pass parameters through to the JVM > when > rem installing the service, or when running in a console. > > # setup VM's memory settings, variables picked up by > ../conf/vww-wrapper.conf > # see https://wiki.eng.vmware.com/CloudVM/Sizing > # APP_NAME must match entry in vws-wrapper.conf > set APP_NAME=vmware-vws > if not defined VMWARE_JAVA_HOME exit 2 > if not defined VMWARE_CLOUDVM_RAM_SIZE exit 3 > if not defined VMWARE_LOG_DIR exit 4 > > set JAVA_HOME=%VMWARE_JAVA_HOME% > set /a MAXMEM_VALUE=0 > set /a MINMEM_VALUE=0 > set /a VAR=0 > set size_cmd='"%VMWARE_CLOUDVM_RAM_SIZE%" %APP_NAME%' > for /f %%A in (%size_cmd%) do ( > set /a VAR=%%A > ) > set /a MAXMEM_VALUE += %VAR% > if %MAXMEM_VALUE == 0 exit 5 > if %MINMEM_VALUE% == 0 set MINMEM_VALUE=16 > echo "'%APP_NAME%' is using a starting heap of %MINMEM_VALUE% and a max of > %MAXMEM_VALUE% mb > > rem Do not modify anything beyond this point > rem --------------------------------------------------- > .... > > > BTW, this warning was helpful was well since the design we were toying > with internally was not placing > wrapper.java.command=c:\some-wrapper-that-calls-java\script.bat > > And was seeing this: > > DEBUG | wrapper | 2012/10/24 14:35:51 | Waiting 5 seconds before > launching another JVM. > DEBUG | wrapper | 2012/10/24 14:35:56 | Magic number for file > vmware-vws.bat: 0x4072656d > WARN | wrapper | 2012/10/24 14:35:56 | The value of > wrapper.java.command does not appear to be a java binary. > WARN | wrapper | 2012/10/24 14:35:56 | The use of scripts is not > supported. Trying to continue, but some features may not work correctly.. > > Mike MacFaden > Staff Engineer, VMware , Palo Alto CA > > ------------------------------ > > Michael, > There are a number of ways to pass values into the Wrapper to do what you > want. The method you use will depend on the circumstances under which you > will be changing the memory size settings. > > 1) Environment variables. > http://wrapper.tanukisoftware.com/doc/english/props-envvars.html > It is possible to reference any environment variable from within your > wrapper.conf file. These values of course will only work when the > environment is loaded. This means that if you change the environment > (SYSTEM in most cases) you will need to restart the Wrapper service itself > for the changes to take affect. If you use environment variables, you do > so as follows: > > Environment: > > > -- Leif Mortenson Tanuki Software, Ltd. 6-16-7-1001 Nishi-Kasai, Edogawa-ku Tokyo 134-0088 Japan Tel: +81-3-3878-3211 Fax: +81-3-3878-0313 http://www.tanukisoftware.com lei...@ta... |