Why does it take so long to start OpenMRS in Tomcat?

Application Name: Platform Version Number: 1.11.5 Modules Reference Application 2.3.1 bundle

Question: Why many time after launching the Tomcat service, it takes so much time to go to the OpenmMRS webapp? Going to the webpage index or tomcat manager is very slow more then several minutes, I have already installed all the plugins and I don’t think it has to rebuild the index at each start.

Can you please help me on how to figure this out ?

It typically takes several minutes to start the OpenMRS webapp in tomcat (with all the Reference Application modules included).

If you are watching the tomcat log file, the steps that are slowest willlook something like these:

INFO - ServiceContext.startRefreshingContext(902) |2016-02-01 11:40:48,116| Refreshing Context
INFO - LocalSessionFactoryBean.buildSessionFactory(780) |2016-02-01 11:40:59,933| Building new Hibernate SessionFactory

How long does this actually take to load for you? If it’s taken >5 or >10 minutes (depending on your machine), that would be longer than I expect. (Also, make sure you have given enough memory to tomcat, per https://wiki.openmrs.org/x/gxAz)

Or are you saying that every page load takes multiple minutes? That would be unexpected.

1 Like

No every single page , but the staring point the first launch of the webapp after Tomcat has been restarded

and regarding this value (-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m), can I Upgrade them like from 256m to 512m from 512m to 1024m ??

also I’m having this error from the stdout after I have restarded the tomcat and tried to access to OpenMRS webapp

has anyone resolved this issue. When tomcat started with openmrs it is stucked at refreshing context steps >30min . from code it seems it is refreshing spring context for service calls. Not sure which service call call refersh is causing so much time. without logs .it is difficult to track down root cause. INFO - ServiceContext.startRefreshingContext(883) |2016-04-30 12:16:59,960| Refreshing Context

has anyone yet resolved this issue?

@rlokhande which version of the openmrs platform and which modules do you have?

using Platform version - 1.10.2

And using below modules

  • allergyapi-1.4-SNAPSHOT.omod
  • allergyui-1.1-SNAPSHOT.omod
  • appframework-2.3-SNAPSHOT.omod
  • appointmentscheduling-1.4-SNAPSHOT.omod
  • appointmentschedulingui-sehat-1.0.3-SNAPSHOT.omod
  • appui-1.3-SNAPSHOT.omod
  • aws-1.9.6-SNAPSHOT.omod
  • calculation-1.1.omod
  • coreapps-1.5-SNAPSHOT.omod
  • dataexchange-1.3.2-SNAPSHOT.omod
  • emr-2.0-SNAPSHOT.omod
  • emrapi-1.5-SNAPSHOT.omod
  • event-2.1.omod
  • formentryapp-sehat-1.2-SNAPSHOT.omod
  • htmlformentry-2.6-SNAPSHOT.omod
  • htmlformentry19ext-1.4.omod
  • htmlformentryui-1.2-SNAPSHOT.omod
  • htmlwidgets-1.6.5.omod
  • idcards-1.3.2-SNAPSHOT.omod
  • idgen-3.1-SNAPSHOT.omod
  • jasperreport-1.5.6-SNAPSHOT.omod
  • messaging-sehat-1.0-SNAPSHOT.omod
  • metadatadeploy-1.5-SNAPSHOT.omod
  • metadatamapping-1.0.1.omod
  • metadatasharing-1.1.9-SNAPSHOT.omod
  • namephonetics-1.4.omod
  • openhmis.backboneforms-sehat-1.0-SNAPSHOT.omod
  • openhmis.cashier-sehat-1.0-SNAPSHOT.omod
  • openhmis.commons-sehat-1.0-SNAPSHOT.omod
  • openhmis.inventory-sehat-1.0-SNAPSHOT.omod
  • orderentryui-1.0-SNAPSHOT.omod
  • orderextension-2.0-SNAPSHOT.omod
  • providermanagement-sehat-2.3-SNAPSHOT.omod
  • referenceapplication-2.2-SNAPSHOT.omod
  • referencedemodata-1.4-SNAPSHOT.omod
  • referencemetadata-2.4-SNAPSHOT.omod
  • registrationapp-sehat-1.0-SNAPSHOT.omod
  • registrationcore-sehat-1.0-SNAPSHOT.omod
  • reporting-0.9.3-SNAPSHOT.omod
  • reportingrest-1.4.omod
  • reportingrest-sehat-1.5-SNAPSHOT.omod
  • serialization.xstream-0.2.7.omod
  • simplelabentryui-sehat-1.1-SNAPSHOT.omod
  • uicommons-1.4-SNAPSHOT.omod
  • uiframework-3.3-SNAPSHOT.omod
  • uilibrary-2.0.4.omod
  • webservices.rest-2.11-SNAPSHOT.omod
  • xforms-4.3.2-SNAPSHOT.omod

@rlokhande is there any particular reason why you are not using version 1.11.6 of the OpenMRS platform?

already huge amount of work is done based on this version and updating will need lots of efforts and testing. to avoid that we are stick to this version. is there any patch for this particular issue that can be applied to reduce timeline while refreshing context…

Was is always this slow? Or did it just start happening? After adding a new module or two?

Observing after adding more modules. It just takes lots of RAM . If enough RAM is provided (aroung 3GB) then it takes around 10 min.

I have this exact same issue, tomcat logs is stucked at refreshing context steps.

Cannot start and or access openmrs in browser. I cant even check the openmrs version to state it here.

Can you share the server side log via pastebin.com?

i am getting a similar problem, after adding modules and restarting tomcat, it takes too long to start. I installed core 2.07. Here are the logs https://pastebin.com/k9B3FEpu

if you happened to have included a custom module, that could be the issue, platform 2.x in my experience has improved start time compared to 1.x. One cause could be you have called a service class at your class level