How could I reduce the Hybris server startup time?
Asked Answered
E

13

11

I am working on a Hybris project and it is very time consuming to wait 350 - 550 sec for a single Hybris server startup, for even just a little modification/misstype in the code. Is it possible to reduce this time by running only those extensions I have modified or any other way? That would be a great thing.

Epiblast answered 9/2, 2016 at 10:22 Comment(0)
F
14

+1 on JRebel. It works well with hybris. Sure, it's expensive, but you'll rapidly get the ROI savings. The initial load is slower, but once it's up it'll save a lot of time.

The other thing to do is to take a look at your localextensions.xml and ensure only the extensions you need for your project are in there. It makes a big difference to the start up time.

I've also seen reasonable start up time improvements through using a DB other than HSQL when running the platform. I use MySQL locally.

The other thing is to ensure you've got enough grunt in the machine you're using. I've just started the platform here and even with JRebel running it's 'only' taken 200 seconds. I'd suggest looking at a quad core CPU and an SSD to improve times for local development.

Fatwitted answered 10/2, 2016 at 8:54 Comment(4)
Have you ever used JRebel with IntelliJ on a Hybris project? If so, could you please help me out with the setup?Epiblast
JRebel is great but too expensive unless your company buy a license for you. I have never been able to use an open source alternative successfully with hybris.Slope
I'm an Eclipse guy. It's pretty straightforward to use hybris with JRebel though - there's instructions here wiki.hybris.com/display/release5/How+to+Use+JRebel Only thing I'd imagine is different would be the configuration of the extension in IntelliJ versus Eclipse.Fatwitted
but what do you do when you need to add a new type into the system. Even though you have JRebel you need to stop the server, perform a build and start the server back again. In order to avoid that you can use the following youtube.com/watch?v=NHtMg8vZfdI&feature=youtu.beViradis
E
9

you will find in this article all instructions to speed up your server startup time up to 50 % by

  1. disabling Cronjobs
  2. Removing unused tenants
  3. Modifing tomcat startStopThreads
  4. Excluding Some Jars From Scanning

https://hybrismart.com/2016/12/27/speed-up-server-start-time/

Electrodynamics answered 17/5, 2017 at 21:42 Comment(2)
disabling Cronjobs => disabling Cronjobs triggers. can you make the 3rd (Modifing tomcat startStopThreads) point more clear please ?Fichtean
Hello @MohamedNabli , thanks for your question : ) please see this pic : packtpub.com/sites/default/files/Article-Images/… In bref, tomcat server.xml is config file defines an engine , "The Engine element represents the entire request processing machinery ", startStopThreads is the number of threads this Engine will use to start child Host elements in parallel, so if you set this value to 0 , you server will use 1 thread to start so will server will start Quickly ...Electrodynamics
T
3

I would recommend to use Jrebel - it works like a charm with Hybris, and redeploys beans in runtime. The main advantage is that it's able to reconfigure Spring beans without redeploying, so it really saves much time on server restart.

There are open-source alternatives, but they weren't suitable for me, though it's worth to look on them: DCEVM and fakereplace

Tumbling answered 9/2, 2016 at 20:57 Comment(1)
Have you ever used JRebel with IntelliJ on a Hybris project? If so, could you please help me out with the setup?Epiblast
E
2

Try Linux (Ubuntu) instead of Windows. The performance difference is amazing. It's like 1/4 of time for a build and 1/2 of time for a server start. I wish I had figured it out earlier!

Epiblast answered 23/8, 2017 at 6:8 Comment(0)
J
2

I saw lot of comments for people are not able to setup any open source alternative to Jrebels.

Hybris server startup time can't be drastically reduced, specially on windows where it takes around 20 to 30 minutes(if you also have some custom extension build over using the standard extensions).

The only good solution is to use JRebels but the downside of JRebel is that it is too expensive. Good alternative to JRebel is DCEVM + HotSwap. Here are the Steps to setup HotSwap.

What actually JRebel or HotSwap does? It loads the code changes in the live running server. You don't need to restart your server again for each code change.

Please let me know in case you face any kind of issues in setting up the same.

Jepum answered 2/11, 2018 at 13:54 Comment(0)
G
1

I'd suggest to disable a few heavy extensions, which you are using during the development process and enable only this extension on which you are working on along with necessary extensions. I don't know, which hybris version you're using, but as far as I know, there gonna be functionality, which should solve your problem in the further releases of the platform, but I'm not 100% sure about that.

Gracye answered 12/2, 2016 at 16:17 Comment(0)
E
1

Thanks to all of you, who wrote an answer! :) Actually I found a really great solution for my own question:

  • I modified the context.xml in the platform/tomcat/conf folder to be reloadable and to watch the WEB-INF folder
  • I use IntelliJ to do the developing stuff, and it has an option to compile things, like a single java file or a whole package/module/extension. So I modified the compilation path to the WEB-INF/classes and that's all.

Now if I start a hybris server and I modify (or create) a file in my project, I just run a compile on the modified package or just on the single current file and after a few seconds Tomcat reloads the modified stuff in the current extension.

UPDATE: Since a Hybris extension could not use the "webapp" part of other extensions, it seems like it is not possible to reload any dependency. So my solution is working only on "webapp only" extensions.

Epiblast answered 13/2, 2016 at 18:29 Comment(0)
L
0

You would also like to check https://wiki.hybris.com/display/partnerblog/2013/09/23/Avoid+restarting+the+server+as+much+as+possible . Although, this is not a direct answer to your question, it states how to avoid server restart.

Literatim answered 13/2, 2016 at 5:32 Comment(0)
M
0

Please use this properties in local.properties file

#Performance mode
build.development.mode=false
tomcat.development.mode=false
storefront.granule.enabled=true
addonfilter.active=false
Mohun answered 9/7, 2016 at 7:59 Comment(1)
I'm sure this works, but it would be great if you explained what all those options do and why they help.Vibraphone
C
0

Try to put only required extension in localextension.xml.
You can stop Solr server from autostarting by disabling it through local.properties file.
And if you are running hybris server on intel-i3/AMD processor,please upgrade to intel-i5 with minimum of 8 GB RAM.

Cheddite answered 25/8, 2016 at 12:6 Comment(0)
R
0

So I have been using JRebel along with Hybris since past one year.

Although I have not been able to configure this with my IDE (I am sure there is a simple way), the usage is pretty straightforward.

After I have modified any java file or spring configuration, in a terminal different from the one I have my server running in, I navigate to the extension in which I have modified the files and then do an ant build. The modified files are picked up by the running server (you can see the new files/configuration being picked up in the server console).

Regarding the license, I use myJRebel license from https://my.jrebel.com/ which requires a social media login to obtain the license key.

Steps to Setup -

  1. Download the JRebel Library (standalone zip)
  2. Extract to your preferred location. Mine is C:\Monil\Tools\jrebel
  3. Add following to your local.properties (modify accordingly)

    tomcat.debugjavaoptions=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -Xverify:none -agentpath:c:/Monil/Tools/jrebel/lib/jrebel64.dll -Xbootclasspath/p:${HYBRIS_TEMP_DIR}/hybris/rebelboot.jar

Please note that the ${HYBRIS_TEMP_DIR}/hybris/rebelboot.jar jar will automatically be added to hybris temp directly when you do a ant all and start your server.

Relic answered 10/5, 2017 at 6:9 Comment(0)
P
0

Next to reducing the amounts of restarts with JRebel (like mentioned in previous answers) it is important on which operation system you are working on. If you are working on a windows computer, I would higly recommend to make use of an unix system. So in my opinion you have the following options:

If you are not familiar with Docker (which needs a bit of learning), than give WSL2 on Windows a try.

Here I could speed up the build and startup times near factor 3, compared to the normal windows approach.

Hope this will help you to speed up your work :-)

Pernik answered 21/4, 2021 at 13:0 Comment(0)
P
0

Add these properties in local.properties

cronjob.timertask.loadonstartup=false

installed.tenants=

task.engine.loadonstartup=false

backoffice.fill.typefacade.cache.on.startup=false

Also you can configure Jrebel(If you have licence) or configure Hotswap

Philippines answered 17/5 at 5:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.