Sounds like a good idea (we have the same problem). But how do you do it? The Jersey resources are available for traffic only _after_ Application.run() and _after_ Managed.start(), so how do you trigger the endpoints before they are published to external clients?
Cheers, /Patrik On Friday, September 16, 2016 at 6:43:09 PM UTC+2, Evan Meagher wrote: > > Right, warmup requests should only cover idempotent endpoints and > typically only reads. > > On Fri, Sep 16, 2016 at 3:05 AM, Andrejs Jermakovics < > [email protected] <javascript:>> wrote: > >> Thank you for you suggestions! >> Warmup requests make a lot of sense and are quite easy to do but we have >> to be careful not to produce any side effects. >> >> On Wednesday, September 14, 2016 at 6:03:57 PM UTC+1, Evan Meagher wrote: >>> >>> 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 <[email protected]> >>> 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 < >>>> [email protected]> 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 [email protected]. >>>>> 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 [email protected]. >>>> 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 [email protected] <javascript:>. >> 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
