• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Srping based application warm-up

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Spring forum

I'm working on a Spring application with some moderate traffic (around 300 QPS), This application is running in my company private cloud. Sometimes the cloud engineers needs to migrate the application from one host (VM) to another one and we got a bunch of timeouts.
The reason we suspect is that when the new application start up in the new node, the traffic hit the application so fast that the application itself don't have time to initialize DB pooled connections / cache service connections / maybe Spring beans in memory (?) fast enough to handle the incoming requests.

When we do a regular version release before make the new version public we have to hit the app a couple of time to warm it up and avoid having timeouts as soon as the app is released.

My question here then is, is there a nice way to do this using Spring? I believe this problem is common so hopefully there is a standard way to avoid this kind of situations.

More information about the app

Type: Rest web service API
Spring version: 3.1.1
WebServer: Tomcat 7

Please let me know if there is some other relevant information you might need. Thank you very much!
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about having an initialization servlet that makes a few database calls or API calls that load those Spring beans?
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ideally, your application should be "warmed up" on init. This way everything will be initialized before requests come to the application.

Out of the box, SPring is configured to load all beans on startup. Also, if you use Spring MVC the dispatcher servlet loads the spring context on startup. You mentioned you are implementing a REST Web service. What are you using for building REST services? Spring MVC or Jersey?
reply
    Bookmark Topic Watch Topic
  • New Topic