More generally, it's not uncommon for server programs on the JVM to benefit from some initial "warmup" workload to allow for classloading, JIT compilation, and other runtime optimizations to kick in before serving external traffic. A good way to go about doing this is to send a series of warmup requests <https://cloud.google.com/appengine/docs/java/warmup-requests/> through the application before opening the server port to external traffic.
One way to achieve this might be to add a hook to AbstractServerFactory to allow an application to provide a `Consumer<Handler>` that the application context handler could be applied to. The provided function could then issue warmup requests directly to the application servlet handler. I may be missing some caveat about the pre-start portion of Jetty's server lifecycle. More research would be necessary if someone chose to pursue this feature. On Wed, Sep 14, 2016 at 9:21 AM, Tatu Saloranta <tsalora...@gmail.com> wrote: > One aspect that would be easy enough to support is warming up of > data-binding library, Jackson. Ideally it'd be done by exercising > ObjectMapper that DropWizard uses (and preferably with actual types used > for serialization/deserialization); but even just creating an instance > and doing simple ser/deser can help with JVM aspects. > > I don't know how big part of first-call overhead is from data-binding but > I know it is non-trivial relative to steady-state overhead (first call > taking hundreds of milliseconds, potentially, steady state fraction of a > millisecond) > > -+ Tatu +- > > > On Wed, Sep 14, 2016 at 2:06 AM, Andrejs Jermakovics < > andrejs.jermakov...@gmail.com> wrote: > >> Hi all, >> >> >> Is there any way to 'warm-up' dropwizard before handling requests? >> >> What we're observing is that the first request to an endpoint is quite >> slow but all the subsequent ones are fast. I assume that some >> initialization is happening the first time you hit an endpoint but we >> couldn't find a way to trigger it. >> Any ideas would be much appreciated! >> >> >> Thank you, >> Andrejs >> >> -- >> You received this message because you are subscribed to the Google Groups >> "dropwizard-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to dropwizard-user+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "dropwizard-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dropwizard-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Evan Meagher -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.