简体   繁体   English

SAP Hybris - Tomcat 忽略 memory 设置

[英]SAP Hybris - Tomcat ignoring memory settings

I'm running a local installation of SAP Hybris 1811. I'm trying to increase its memory size since I've been getting OutOfMemory exceptions during SOLR index jobs.我正在本地安装 SAP Hybris 1811。我正在尝试增加其 memory 大小,因为在 SOLR 索引作业期间我遇到了 OutOfMemory 异常。

However, I'm not able to reliably increase the memory via any method I've tried.但是,我无法通过我尝试过的任何方法可靠地增加 memory。 Sometimes after struggling a lot (building the app multiple times, restarting, etc.) Hybris is able to see and use the set memory (I check this using backoffice), but most of the time it defaults to 2 GB and runs out of memory quickly.有时经过很多努力(多次构建应用程序,重新启动等)Hybris 能够看到并使用集合 memory(我使用后台检查),但大多数时候它默认为 2 GB 并且用完 memory迅速地。

What I've tried:我试过的:

  • set JAVA_OPTS=-Xms10G -Xmx10G; in catalina.batcatalina.bat
  • tomcat.javaoptions=-Xmx10G -Xms10G in local.properties tomcat.javaoptions=-Xmx10G -Xms10G in local.properties

What is the correct way to reliably set a higher memory for local Hybris server?为本地 Hybris 服务器可靠地设置更高的 memory 的正确方法是什么?

Please try the following in your local.properties:请在 local.properties 中尝试以下操作:

tomcat.generaloptions=-Xmx10G -ea -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true -Djava.endorsed.dirs="%CATALINA_HOME%/lib/endorsed" -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% -Dfile.encoding=UTF-8  -Djava.util.logging.config.file=jdk_logging.properties -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}"

Please make sure to execute ant after making this change.请确保在进行此更改后执行ant As a general note, whenever you make any change related to tomcat, you need to execute ant .作为一般说明,每当您进行与 tomcat 相关的任何更改时,您都需要执行ant

For production environment, you can set this property as follows:对于生产环境,您可以按如下方式设置此属性:

java.mem=10G
tomcat.generaloptions=-Xmx${java.mem} -Xms${java.mem} -Xss256K -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+CMSScavengeBeforeRemark  -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:"${HYBRIS_LOG_DIR}/tomcat/java_gc.log" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true -Djava.endorsed.dirs=../lib/endorsed -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=jdk_logging.properties -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}" -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

After a bit of digging, I found that the memory limit was ignored only when I've tried to run Hybris server with the debug parameter.经过一番挖掘,我发现只有当我尝试使用debug参数运行 Hybris 服务器时,才会忽略 memory 限制。 I discovered that the properties I've tried to set using tomcat.javaoptions were not in the wrapper-debug.conf file which is used when starting the server in debug mode.我发现我尝试使用tomcat.javaoptions设置的属性不在以调试模式启动服务器时使用的wrapper-debug.conf文件中。

Long story short:长话短说:

tomcat.javaoptions only gets applied to the default wrapper.conf file and is ignored when launching the server with any parameter such as debug . tomcat.javaoptions仅应用于默认的wrapper.conf文件,并在使用任何参数(例如debug )启动服务器时被忽略。

For the changes to be applied to the wrapper-debug.conf , I needed to use tomcat.debugjavaoptions property.对于要应用于wrapper-debug.conf的更改,我需要使用tomcat.debugjavaoptions属性。

In the end, my config file with working memory limit looks like this:最后,我的配置文件与工作 memory 限制看起来像这样:

...
tomcat.javaoptions=-Xmx10G -Xms5G
tomcat.debugjavaoptions=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -Xmx10G -Xms5G

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM