Java Heap Size Issue

When starting the Ignition Gateway as a service, I kept running into a problem where the Java heap size on the JVM was too large and the service would crash and fail to start. I was able to work around this by editing the .conf file so that my heap size was 512MB instead of 1024. However, I am wondering how this will affect the performance of Ignition if at all. Does anybody have any pointers on this?

In general, as long as changes to heap size are reasonable (for your machine, operating system architecture, and environment) Ignition will either get better or the same performance from increased heap space. Note that limitations include:

  1. Version of Java installed/in use by the system. 32-bit Java can only address ~1.5gB of RAM.
  2. OS architecture - while they’re increasingly uncommon, a 32-bit OS will have similar hard max memory restrictions.
  3. System specs - whether a dedicated machine or a VM, dedicating, say, 7gB out of the 8gB physically installed to Java is going to cause you more problems, not fewer.
    If you have 8gB or more of RAM, then increasing the Ignition heap to 2gB max (or even 4) should be fine - but be wary of doing that if you’re also running, say, MySQL or MSSQL on the same machine; databases tend to consume as much memory as they possibly can.
1 Like

Ignition now nicely shows the heap size in the Status > Performance page of the gateway.

Perhaps you could share that info with us, so we can advise some settings? 512MB seems fairly low to me, but if you have a small project, it might be the best setting.

1 Like

I have several small projects, but one mid-size project which will definitely be increasing. I have begun making adjustments to the heap size with good results. If I run into issues I will reply to this thread.

Ok so it looks like sometimes I am pushing it a little too much with the object heap size. Sometimes I seem to hit the limit I imposed on the heap size which is causing some errors, and I cannot increase my max heap size to more than 768MB. I am going to need a larger heap size eventually as the size of my projects increase. These are my operating parameters.

Java, Ignition, and my OPC servers are all 32-bit. I am running Ignition on windows server 2012. I have 16Gb of RAM. I can attach the wrapper log info if needed.

The 16GB of RAM is utterly useless with 32-bit Java.

1 Like

Why? If you hit the limit, you'll have to increase it.

And Phil is correct, 32-bit software can only use a theoretical maximum of 4GB RAM, usually a bit lower. So 16 GB is useless.

My original post has the answer to your first question. JVM could not allocate 1024 MB of memory.

But I am not even approaching that theoretical Max of 4GB of RAM. I am using a max heap size of less than 1GB

But does that explain why I can’t even use 1 GB of Memory before the JVM fails?

You’re gonna have to look at the OS’s task manager to tell you what’s going on. What else is running on this server? Hopefully not your database.

Yes I do have my database running on this machine, but my memory usage is only 15%. Nothing unusual going on in the background.

Why not? If the DB and the Ignition project are relatively small, this should work fine, right?

The JVM has a limit of 1.5 GB on a 32 bit OS.

Yes but my problem is I cannot even get 1 GB out of it for the JVM

When you say “crash and fail to start” - where are you seeing crashing, and where are you seeing failed to start? Can you go to the wrapper.log file and either upload it or cut out the last few lines when it’s attempting to restart and post it here?

Ok maybe crashing is the wrong word but the JVM can’t get he memory it needs so it fails to start. I found that in the wrapper logs.

DEBUG | wrapper | 2018/06/01 15:34:37 | JVM started (PID=3724)
INFO | jvm 1 | 2018/06/01 15:34:37 | Error occurred during initialization of VM
INFO | jvm 1 | 2018/06/01 15:34:37 | Could not reserve enough space for 1048576KB object heap
DEBUG | wrapper | 2018/06/01 15:34:37 | JVM process exited with a code of 1, setting the wrapper exit code to 1.
DEBUG | wrapper | 2018/06/01 15:34:37 | 1: STATUS_WAIT_1 (0x1)
ERROR | wrapper | 2018/06/01 15:34:37 | JVM exited while loading the application.

These lines repeat five times( from a setting in the service properties) then exits with the following lines

FATAL | wrapper | 2018/06/01 15:34:59 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.
FATAL | wrapper | 2018/06/01 15:34:59 | There may be a configuration problem: please check the logs.
DEBUG | wrapperp | 2018/06/01 15:34:59 | closing backend server.
STATUS | wrapper | 2018/06/01 15:34:59 | <-- Wrapper Stopped

Show your ignition.conf contents, please. And please use triple-back-ticks on a line before and a line after your paste so it’ll format nicely.

#encoding=UTF-8
# Configuration files must begin with a line specifying the encoding
#  of the the file.

#********************************************************************
# Wrapper License Properties (Ignored by Community Edition)
#********************************************************************
# Professional and Standard Editions of the Wrapper require a valid
#  License Key to start.  Licenses can be purchased or a trial license
#  requested on the following pages:
# http://wrapper.tanukisoftware.com/purchase
# http://wrapper.tanukisoftware.com/trial

# Include file problems can be debugged by removing the first '#'
#  from the following line:
#include.debug

# The Wrapper will look for either of the following optional files for a
#  valid License Key.  License Key properties can optionally be included
#  directly in this configuration file.
#include ./wrapper-license.conf

# The following property will output information about which License Key(s)
#  are being found, and can aid in resolving any licensing problems.
#wrapper.license.debug=TRUE

#********************************************************************
# Wrapper Localization
#********************************************************************
# Specify the locale which the Wrapper should use.  By default the system
#  locale is used.
#wrapper.lang=en_US # en_US or ja_JP

# Specify the location of the Wrapper's language resources.  If these are
#  missing, the Wrapper will default to the en_US locale.
wrapper.lang.folder=../lang

#********************************************************************
# Wrapper Java Properties
#********************************************************************
# Java Application
#  Locate the java binary on the system PATH:
wrapper.java.command=
#  Specify a specific java binary:
#set.JAVA_HOME=/java/path
#wrapper.java.command=

# Tell the Wrapper to log the full generated Java command line.
wrapper.java.command.loglevel=debug

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=lib/wrapper.jar
wrapper.java.classpath.2=lib/catapult.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=lib

# Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
#wrapper.java.additional.1=-XX:+UseConcMarkSweepGC
wrapper.java.additional.2=-XX:+CMSClassUnloadingEnabled
wrapper.java.additional.3=-Ddata.dir=data
wrapper.java.additional.4=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
#wrapper.java.additional.5=-Xdebug
#wrapper.java.additional.6=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=254

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1024

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=com.inductiveautomation.catapult.Catapult

wrapper.shutdown.timeout=120
wrapper.jvm_exit.timeout=120

# Set this value to TRUE to allow ignition.conf to be reloaded when the JVM is restarted
wrapper.restart.reload_configuration=TRUE

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Enables Debug output from the Wrapper.
#wrapper.debug=TRUE

# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=logs/wrapper.log

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=debug

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=10m

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=5

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=DEBUG

#********************************************************************
# Wrapper General Properties
#********************************************************************
# Allow for the use of non-contiguous numbered properties
wrapper.ignore_sequence_gaps=TRUE

# Title to use when running as a console
wrapper.console.title=Ignition Gateway

#********************************************************************
# Wrapper JVM Checks
#********************************************************************
# Detect DeadLocked Threads in the JVM. (Requires Standard Edition)
#wrapper.check.deadlock=TRUE
#wrapper.check.deadlock.interval=60
#wrapper.check.deadlock.action=RESTART
#wrapper.check.deadlock.output=FULL

# Out Of Memory detection.
#wrapper.filter.trigger.1000=java.lang.OutOfMemoryError
#wrapper.filter.action.1000=RESTART
#wrapper.filter.message.1000=The JVM has run out of memory.

wrapper.on_exit.default=SHUTDOWN
wrapper.on_exit.2=RESTART

#********************************************************************
# Wrapper Email Notifications. (Requires Professional Edition)
#********************************************************************
# Common Event Email settings.
#wrapper.event.default.email.debug=TRUE
#wrapper.event.default.email.smtp.host=<SMTP_Host>
#wrapper.event.default.email.smtp.port=25
#wrapper.event.default.email.subject=[%WRAPPER_HOSTNAME%:%WRAPPER_NAME%:%WRAPPER_EVENT_NAME%] Event Notification
#wrapper.event.default.email.sender=<Sender email>
#wrapper.event.default.email.recipient=<Recipient email>

# Configure the log attached to event emails.
#wrapper.event.default.email.attach_log=TRUE
#wrapper.event.default.email.maillog.lines=50
#wrapper.event.default.email.maillog.format=LPTM
#wrapper.event.default.email.maillog.loglevel=INFO

# Enable specific event emails.
#wrapper.event.wrapper_start.email=TRUE
#wrapper.event.jvm_prelaunch.email=TRUE
#wrapper.event.jvm_start.email=TRUE
#wrapper.event.jvm_started.email=TRUE
#wrapper.event.jvm_deadlock.email=TRUE
#wrapper.event.jvm_stop.email=TRUE
#wrapper.event.jvm_stopped.email=TRUE
#wrapper.event.jvm_restart.email=TRUE
#wrapper.event.jvm_failed_invocation.email=TRUE
#wrapper.event.jvm_max_failed_invocations.email=TRUE
#wrapper.event.jvm_kill.email=TRUE
#wrapper.event.jvm_killed.email=TRUE
#wrapper.event.jvm_unexpected_exit.email=TRUE
#wrapper.event.wrapper_stop.email=TRUE

# Specify custom mail content
wrapper.event.jvm_restart.email.body=The JVM was restarted.\n\nPlease check on its status.\n

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.name=Ignition

# Display name of the service
wrapper.displayname=Ignition Gateway

# Description of the service
wrapper.description=Ignition Gateway

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START, DELAY_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

#VERSION - DO NOT MODIFY: 9

Huh. Looks just fine. You might just need to do a remote assistance session with IA support.

Thank for taking the time to look. Another small questions. Would turning off asynchronous read/write operations in a server configuration have the potential to cause read timeouts on tags?