Improve hybris Startup time up to 50%

I’ve done some findings that helped me get the hybris startup time down to 40-50%. This article provides several recommendations on how to make hybris/Tomcat to start up faster.

All pieces of advice below are only for the development environments because most of them have side effects important for the production system.

Cronjobs: turn them off

In order to disable cronjobs to start automatically on the server startup you need to add cronjob.timertask.loadonstartup=falsein local.properties.  You can also update triggers’ maxAcceptableDelay:

UPDATE Trigger[batchmode=true];itemtype(code)[unique=true];maxAcceptableDelay
;Trigger;1800

Tenants: Remove unused

Remove unused tenants in the local.properties (like the one for junit) if not needed

#default: installed.tenants=junit,foo,t1,t2
installed.tenants=

Heavy project (2790 custom java classes on top of Hybris accelerator, db:mysql local)
load time before changes: 857 sec
load time after changes:   679 sec (-20%)
See the configuration of my laptop below.

Tomcat: load Host and Engine containers in parallel

…The number of threads this Engine will use to start child Host elements in parallel. The special value of «0» will result in the value of Runtime.getRuntime().availableProcessors() being used. Negative values will result in Runtime.getRuntime().availableProcessors() + value being used unless this is less than 1 in which case 1 thread will be used. If not specified, the default value of 1 will be used. // http://tomcat.apache.org/tomcat-7.0-doc/config/engine.html

However, take into account that hybris is not thread safe during start-up and many parallel processes may lead to unexpected behavior. Even if it works on local machine (e.g. QuadCore) it might not work on a production environment (e.g 12 or 24 cores). So delete this configuration if you face any problems. Also take into account that hybris will eat more cpu with this configuration.

config/tomcat/conf/server.xml:

2016-12-27_18h15_38.png

Heavy project (2790 custom java classes on top of Hybris accelerator, db:mysql local)
load time before changes: 857 sec
load time after changes:   644 sec (-24%)
See the configuration of my laptop below.

Excluding Some Jars From Scanning

First, you can remove the following jars from bin/platform/tomcat/lib, because websockets seem not used in hybris:

  • tomcat7-websocket.jar
  • websocket-api.jar

The second thing is to remove the Servlet 3 scanning. For that, you need to change the following key in catalina.properties(by default it is empty in hybris)

org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar

The last change in this section is turning off the TLD scanning for all but a few JARs where we definetely know there exists TLDs. In the listed jars there are no *.tld so they can be skipped by tomcat’s TLDConfig:

org.apache.catalina.startup.TldConfig.jarsToSkip=re11-1.22.jar,\
acceleratorcmshmchmc.jar,\
acceleratorserviceshmchmc.jar,\
admincockpitserver.jar,\
advancedsavedqueryserver.jar,\
amwaycontentsolrsearchaddonhmc.jar,\
annotations-2.0.0.jar,\
annotations-api.jar,\
ant-commons-net-1.6.5.jar,\
aopalliance-1.0.jar,\
asm-1.0.2.jar,\
asm-3.3.1.jar,\
aspectjweaver-1.8.5.jar,\
assertj-core-3.5.2.jar,\
atlantic-1.1.2.jar,\
avalon-framework-4.2.0.jar,\
backoffice-core-1.0.2.1.jar,\
backoffice-core-6.2.0.0-RC7-sources.jar,\
backoffice-core-6.2.0.0-RC7.jar,\
backoffice-module-6.2.0.0-RC9-sources.jar,\
backoffice-widgets-1.0.2.1.jar,\
backoffice-widgets-6.2.0.0-RC7-sources.jar,\
backoffice-widgets-6.2.0.0-RC7.jar,\
backofficeserver.jar,\
barcode4j-light-2.0.jar,\
basecommercehmchmc.jar,\
batik-all-1.7.jar,\
bcprov-jdk15-1.46.jar,\
bmecathmchmc.jar,\
bmecathmcserver.jar,\
bmecatserver.jar,\
bsh-2.0b5.jar,\
btc-ascii-table-1.0.jar,\
canvas-1.0-hybris-patched.jar,\
catalina-ant.jar,\
catalina-ha.jar,\
catalina-jmx-remote.jar,\
catalina-tribes.jar,\
catalina.jar,\
catalogserver.jar,\
cglib-nodep-2.2.2.jar,\
ckez-4.4.6.1.jar,\
classificationsystemshmchmc.jar,\
classificationsystemsserver.jar,\
cloning-1.9.0.jar,\
cms2hmchmc.jar,\
cms2hmcserver.jar,\
cms2libserver.jar,\
cms2server.jar,\
cmscockpitserver.jar,\
cmswebservicesserver.jar,\
cockpit-data-integration-6.2.0.0-RC7-sources.jar,\
cockpit-data-integration-6.2.0.0-RC7.jar,\
cockpit-demo-widgets-1.0.2.1.jar,\
cockpit-demo-widgets-6.2.0.0-RC7-sources.jar,\
cockpit-demo-widgets-6.2.0.0-RC7.jar,\
cockpit-module-aggregator-1.0.2.1.jar,\
cockpit-module-aggregator-6.2.0.0-RC7-sources.jar,\
cockpit-module-aggregator-6.2.0.0-RC7.jar,\
cockpit-standard-editors-6.2.0.0-RC7-sources.jar,\
cockpit-standard-editors-6.2.0.0-RC7.jar,\
cockpitadmin-1.0.2.1.jar,\
cockpitadmin-6.2.0.0-RC7-sources.jar,\
cockpitadmin-6.2.0.0-RC7.jar,\
cockpitcore-1.0.2.1.jar,\
cockpitcore-6.2.0.0-RC7-sources.jar,\
cockpitcore-6.2.0.0-RC7.jar,\
cockpitframework-1.0.2.1.jar,\
cockpitframework-6.2.0.0-RC7-sources.jar,\
cockpitframework-6.2.0.0-RC7.jar,\
cockpitserver.jar,\
cockpittesting-1.0.2.1.jar,\
cockpittesting-6.2.0.0-RC7-sources.jar,\
cockpittesting-6.2.0.0-RC7.jar,\
cockpitwidgets-1.0.2.1.jar,\
cockpitwidgets-6.2.0.0-RC7-sources.jar,\
cockpitwidgets-6.2.0.0-RC7.jar,\
com.sap.security.core.server.csi-1.00.8.jar,\
commentsserver.jar,\
commercesearchhmchmc.jar,\
commerceserviceshmchmc.jar,\
commons-beanutils-1.9.2.jar,\
commons-codec-1.10.jar,\
commons-collections-3.2.2.jar,\
commons-collections4-4.1.jar,\
commons-configuration-1.10.jar,\
commons-dbcp-1.4.jar,\
commons-digester-2.1.jar,\
commons-discovery-0.5.jar,\
commons-el-1.0.jar,\
commons-email-1.2.jar,\
commons-fileupload-1.3.1.jar,\
commons-httpclient-3.1.jar,\
commons-io-2.4.jar,\
commons-jexl-1.1.jar,\
commons-lang-2.6.jar,\
commons-lang3-3.1.jar,\
commons-lang3-3.4.jar,\
commons-logging-1.2.jar,\
commons-pool-1.6.jar,\
commons-pool2-2.4.2.jar,\
commons-validator-1.4.1.jar,\
commonsserver.jar,\
concurrentlinkedhashmap-lru-1.4.jar,\
coreserver.jar,\
cscockpitserver.jar,\
customerreviewhmchmc.jar,\
ddlutils-1.0.jar,\
deliveryzoneserver.jar,\
easymock-3.1.jar,\
easymockclassextension-3.1.jar,\
ecj-4.4.jar,\
ehcache-2.9.0.jar,\
el-api.jar,\
europe1server.jar,\
fastutil-6.5.6.jar,\
fckez-2.6.1_2-hybris-patched.jar,\
fest-assert-1.4.jar,\
fest-util-1.1.6.jar,\
fop-1.0.jar,\
gmapsz-3.0.0.jar,\
google-guava-libphonenumber-svn-rev10.jar,\
groovy-all-2.4.5.jar,\
guava-18.0.jar,\
hacserver.jar,\
hamcrest-all-1.3.jar,\
hibernate-validator-4.3.2.Final.jar,\
hk2-2.4.0-b31.jar,\
hk2-api-2.4.0-b31.jar,\
hk2-locator-2.4.0-b31.jar,\
hk2-utils-2.4.0-b31.jar,\
hmcserver.jar,\
httpunit-1.7.jar,\
hybris-encryption-1.1.jar,\
hybris-simple-statistics-1.0.1.jar,\
hybriskey-1.0.jar,\
impexserver.jar,\
importcockpithmchmc.jar,\
importcockpithmcserver.jar,\
importcockpitserver.jar,\
instoreserver.jar,\
itext-2.1.7.jar,\
jackson-annotations-2.6.4.jar,\
jackson-core-2.6.4.jar,\
jackson-core-asl-1.9.13.jar,\
jackson-databind-2.6.4.jar,\
jackson-mapper-asl-1.9.13.jar,\
jai-codec-1.1.3.jar,\
jai_core-1.1.3.jar,\
jasper-el.jar,\
jasper.jar,\
jasperreports-4.0.2.jar,\
jasperreports-fonts-4.0.2.jar,\
javassist-3.19.0-GA.jar,\
javax.inject-2.4.0-b31.jar,\
javax.ws.rs-api-2.0.1.jar,\
javolution-5.5.1.jar,\
jaxb-impl-2.2.4-1.jar,\
jaxen-1.1.3.jar,\
jboss-logging-3.2.1.Final.jar,\
jcip-annotations-1.0.jar,\
jcl-over-slf4j-1.7.13.jar,\
jcommon-1.0.16.jar,\
jersey-apache-connector-2.22.1.jar,\
jersey-client-2.22.1.jar,\
jersey-common-2.22.1.jar,\
jersey-entity-filtering-2.22.1.jar,\
jersey-guava-2.22.1.jar,\
jersey-media-json-jackson-2.22.1.jar,\
jersey-media-multipart-2.22.2.jar,\
jersey-server-2.22.1.jar,\
jersey-spring3-2.22.1.jar,\
jersey-test-framework-core-2.22.1.jar,\
jfreechart-1.0.13.jar,\
jgraph-5.8.3.1-hybris-patched.jar,\
jgrapht-jdk1.6-0.8.2.jar,\
jgraphx-1.10.2.1.jar,\
jgroups-3.4.1.Final.jar,\
joda-time-2.9.1.jar,\
json-path-2.0.0.jar,\
json-smart-2.1.0.jar,\
jsp-api.jar,\
jsr305-2.0.0.jar,\
jstl-1.1.0.jar,\
jstl-api-1.2.jar,\
junit-4.12.jar,\
libphonenumber-2.3.jar,\
likey-no-iaik-1.0.3.jar,\
log4j-1.2.17.jar,\
log4j-api-2.4.1.jar,\
log4j-core-2.4.1.jar,\
log4j-slf4j-impl-2.4.1.jar,\
lucenesearchhmchmc.jar,\
mail-1.4.4.jar,\
mccserver.jar,\
mediawebserver.jar,\
metrics-core-3.1.2.jar,\
mime-util-2.1.3.jar,\
mimepull-1.6.jar,\
mobileoptionalshmchmc.jar,\
mobileoptionalshmcserver.jar,\
mobileoptionalsserver.jar,\
mobileserviceshmchmc.jar,\
mobileserviceshmcserver.jar,\
mobileservicesserver.jar,\
mockito-core-1.9.5.jar,\
models.jar,\
oauth2server.jar,\
objenesis-1.4.jar,\
ondemandcommonhmchmc.jar,\
oro-2.0.8.jar,\
paymentstandardserver.jar,\
platformhmchmc.jar,\
pmd-5.0.5.jar,\
poi-3.7.jar,\
previewwebservicesserver.jar,\
processingserver.jar,\
productcockpitserver.jar,\
promotionshmchmc.jar,\
protobuf-lite-libphonenumber-rev10.jar,\
quartz-2.1.2.jar,\
reflections-0.9.9-RC2.jar,\
reportcockpitserver.jar,\
rxjava-1.1.0.jar,\
sac-1.3.jar,\
scimark-2.0.jar,\
scriptingserver.jar,\
serializer-2.7.2.jar,\
servlet-api.jar,\
silvertail-6.5.1.1.jar,\
sitemesh-3.0-alpha-2.jar,\
slf4j-api-1.7.13.jar,\
smppapi-0.3.9.jar,\
snakeyaml-1.4.jar,\
solrfacetsearchhmchmc.jar,\
spring-aop-4.2.7.RELEASE.jar,\
spring-aspects-4.2.7.RELEASE.jar,\
spring-beans-4.2.7.RELEASE.jar,\
spring-context-4.2.7.RELEASE.jar,\
spring-context-support-4.2.7.RELEASE.jar,\
spring-core-4.2.7.RELEASE.jar,\
spring-expression-4.2.7.RELEASE.jar,\
spring-hateoas-0.19.0.RELEASE.jar,\
spring-instrument-4.2.7.RELEASE.jar,\
spring-instrument-tomcat-4.2.7.RELEASE.jar,\
spring-integration-core-4.2.8.RELEASE.jar,\
spring-jdbc-4.2.7.RELEASE.jar,\
spring-jms-4.2.7.RELEASE.jar,\
spring-messaging-4.2.7.RELEASE.jar,\
spring-mobile-device-1.0.1.RELEASE.jar,\
spring-orm-4.2.7.RELEASE.jar,\
spring-oxm-4.2.7.RELEASE.jar,\
spring-security-config-4.0.4.RELEASE.jar,\
spring-security-core-4.0.4.RELEASE.jar,\
spring-security-oauth2-2.0.9.RELEASE.jar,\
spring-security-web-4.0.4.RELEASE.jar,\
spring-test-4.2.7.RELEASE.jar,\
spring-tx-4.2.7.RELEASE.jar,\
spring-web-4.2.7.RELEASE.jar,\
spring-xml-2.2.0.RELEASE.jar,\
standard-editors-1.0.2.jar,\
ticketsystemhmchmc.jar,\
tomcat-api.jar,\
tomcat-coyote.jar,\
tomcat-dbcp.jar,\
tomcat-i18n-es.jar,\
tomcat-i18n-fr.jar,\
tomcat-i18n-ja.jar,\
tomcat-jdbc.jar,\
tomcat-juli-adapters.jar,\
tomcat-util.jar,\
tomcat7-websocket.jar,\
validation-api-1.0.0.GA.jar,\
validationserver.jar,\
velocity-1.7.jar,\
voucherhmchmc.jar,\
webfragmentCore_XSSFilter.jar,\
webfragmentCore_backofficeContextClassloaderFilter.jar,\
webfragmentCore_backofficeMobileFilter.jar,\
webfragmentCore_backofficefilterchain.jar,\
webfragmentCore_requestContextFilter.jar,\
webfragmentCore_springSecurityFilterChain.jar,\
websocket-api.jar,\
workflowserver.jar,\
wrapper.jar,\
wss4j-1.6.19.jar,\
xalan-2.7.2.jar,\
xml-apis-1.3.04.jar,\
xml-apis-ext-1.3.04.jar,\
xmlenc-0.52.jar,\
xmlgraphics-commons-1.4.jar,\
xmlsec-1.4.6.jar,\
xstream-1.4.9.jar,\
ybootstrap.jar,\
ytomcat.jar,\
zcommon-3.6.4.jar,\
zcommon-6.5.1.1.jar,\
zcommon-8.0.2.1.jar,\
zcommons-el-1.0.2.jar,\
zcommons-el-1.1.0.jar,\
zel-6.5.1.1.jar,\
zel-8.0.2.1.jar,\
zhtml-3.6.4.jar,\
zhtml-6.5.1.1.jar,\
zhtml-8.0.2.1.jar,\
zkbind-6.5.1.1.jar,\
zkbind-8.0.2.1.jar,\
zkcharts-2.1.0.jar,\
zkex-3.6.4.jar,\
zkex-6.5.1.1.jar,\
zkex-8.0.2.1.jar,\
zkmax-3.6.4.jar,\
zkmax-6.5.1.1.jar,\
zkmax-8.0.2.1.jar,\
zkplus-3.6.4.jar,\
zkplus-6.5.1.1.jar,\
zkplus-8.0.2.1.jar,\
zkspring-1.1.0.jar,\
zkspring-core-3.0.jar,\
zkspring-core-3.2.0.jar,\
zml-3.6.4.jar,\
zml-6.5.1.1.jar,\
zul-6.5.1.1.jar,\
zul-8.0.2.1.jar,\
zuti-8.0.2.1.jar,\
zxing-core-1.3.jar,\
zxing-javase-1.3.jar

Small project (~300 custom java classes on top of Hybris accelerator, db:hsqldb)
All changes explained before have already been applied to this installation.
load time before changes: 507 sec
load time after changes:   428 sec (-15%)
See the configuration of my laptop below.

If you apply all these changes..

With all these tweaks in place except the last one, skipJars-related, I got the following results:

Heavy project (2790 custom java classes on top of Hybris accelerator, db:mysql local)
load time before changes: 857 sec
load time after changes:   505 sec (-41%)
See the configuration of my laptop below.

I guess that skipJars-related changes should speed up the server a bit more, but the “heavy project” configuration I played around before is no longer available for the tests. Anyway, another configuration shows that these changes work well.

Configuration

Laptop: Dell Latitude E5470
Processor
: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz, 2701 Mhz, 4 Core(s), 8 Logical Processor(s)
Memory: 16 Gb
HDD: SSD SK hynix SC308 256 Gb 2.5″. MLC.
–  Read : 530 Mb/s. Up to 95000 IOPS.
– Write: 380 Mb/s. 85000 IOPS.
NTFS;
Operating system: Windows 10 Enterprise.

I recommend this article on the Tomcat Wiki as well as the Tomcat system properties reference to understand these changes deeper.

3 comments

  1. Hi Rauf,

    Nice article. On quick thing.
    Is backoffice working for you after adding the following config? I had an issue with hybris 5.7 in my dev profile with backoffice after this change.

    org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar

    Thanks
    Shinu

    Like

  2. Feng · · Reply

    Agree with Shinu, after first initialization, “org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar” setting will make backoffice having errors.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: