first form slow to load in OPS

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

first form slow to load in OPS

Adrian Baker-2
After a fresh restart/redeploy, the very first form loaded through OPS
is very slow (up to 10 seconds). After this first rendering, all forms
load very fast - it's only the first load that's problematic, presumably
as the engine initializes itself.

Is this something that others have observed? Is there a way OPS can be
'primed' at start up so that there isn't a delay visible to the user?
Perhaps I could construct a http request server side and fire this at
OPS, but this feels a little... hacky. I might try it in the interim,
but perhaps as a better solution do pipelines need something like a
<load-on-startup> tag similar to the servlet tag that can be specified
in web.xml?

Adrian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: first form slow to load in OPS

Alessandro  Vernet
Administrator
Hi Adrian,

Yes, the first time you access a page, a lot of code will run that
won't need to run on subsequent loads of the same page. There will be
code in PresentationServer but also code in the VM itself (loading
libraries, JIT compiling code ...).

Getting back to your question, there is nothing in PresentationServer
at this point to pre-load pages. The <load-on-startup> should be set,
but it won't help much as it will just make sure that the servlet is
loaded.

Alex

On 3/16/06, Adrian Baker <[hidden email]> wrote:

> After a fresh restart/redeploy, the very first form loaded through OPS
> is very slow (up to 10 seconds). After this first rendering, all forms
> load very fast - it's only the first load that's problematic, presumably
> as the engine initializes itself.
>
> Is this something that others have observed? Is there a way OPS can be
> 'primed' at start up so that there isn't a delay visible to the user?
> Perhaps I could construct a http request server side and fire this at
> OPS, but this feels a little... hacky. I might try it in the interim,
> but perhaps as a better solution do pipelines need something like a
> <load-on-startup> tag similar to the servlet tag that can be specified
> in web.xml?
>
> Adrian
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: first form slow to load in OPS

Greg Jones-4
Adrian,

I haven't tried this myself but you could use the
servlet-initialized-processor to load your home page once the servlet is
started.

By default, OPS runs an XPL file (oxf:/context/servlet-initialized.xpl) when
the servlet is initialized. The default file simply prints out a "Servlet
initialized" message, as follows:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">

    <!-- Display message -->
    <p:processor name="oxf:null-serializer">
        <p:input name="data" debug="message">
            <message>Servlet initialized.</message>
        </p:input>
    </p:processor>
</p:config>

If you haven't turned this off, you could modify the default version to load
your page and prime the system.

Give it a go and let us know if it helps.

Regards,

Greg J.

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Tuesday, 21 March 2006 10:40 AM
To: [hidden email]
Subject: Re: [ops-users] first form slow to load in OPS

Hi Adrian,

Yes, the first time you access a page, a lot of code will run that
won't need to run on subsequent loads of the same page. There will be
code in PresentationServer but also code in the VM itself (loading
libraries, JIT compiling code ...).

Getting back to your question, there is nothing in PresentationServer
at this point to pre-load pages. The <load-on-startup> should be set,
but it won't help much as it will just make sure that the servlet is
loaded.

Alex

On 3/16/06, Adrian Baker <[hidden email]> wrote:

> After a fresh restart/redeploy, the very first form loaded through OPS
> is very slow (up to 10 seconds). After this first rendering, all forms
> load very fast - it's only the first load that's problematic, presumably
> as the engine initializes itself.
>
> Is this something that others have observed? Is there a way OPS can be
> 'primed' at start up so that there isn't a delay visible to the user?
> Perhaps I could construct a http request server side and fire this at
> OPS, but this feels a little... hacky. I might try it in the interim,
> but perhaps as a better solution do pipelines need something like a
> <load-on-startup> tag similar to the servlet tag that can be specified
> in web.xml?
>
> Adrian
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>


--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: first form slow to load in OPS

Alessandro  Vernet
Administrator
Hi Greg,

I thought about doing this when I wrote the reply to Adrian earlier,
but then discarded the idea because you can't use URL generator
directly in that pipeline to make a query to the form, as the servlet
is not initialized yet.

However you can schedule a task that run a pipeline every 10 seconds.
In that pipeline you make the query to the form using the URL
generator and stop the task. That should work :).

Thanks for the suggestion Greg!

Alex

On 3/20/06, Greg Jones <[hidden email]> wrote:

> Adrian,
>
> I haven't tried this myself but you could use the
> servlet-initialized-processor to load your home page once the servlet is
> started.
>
> By default, OPS runs an XPL file (oxf:/context/servlet-initialized.xpl) when
> the servlet is initialized. The default file simply prints out a "Servlet
> initialized" message, as follows:
>
> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>           xmlns:oxf="http://www.orbeon.com/oxf/processors">
>
>     <!-- Display message -->
>     <p:processor name="oxf:null-serializer">
>         <p:input name="data" debug="message">
>             <message>Servlet initialized.</message>
>         </p:input>
>     </p:processor>
> </p:config>
>
> If you haven't turned this off, you could modify the default version to load
> your page and prime the system.
>
> Give it a go and let us know if it helps.
>
> Regards,
>
> Greg J.
>
> -----Original Message-----
> From: Alessandro Vernet [mailto:[hidden email]]
> Sent: Tuesday, 21 March 2006 10:40 AM
> To: [hidden email]
> Subject: Re: [ops-users] first form slow to load in OPS
>
> Hi Adrian,
>
> Yes, the first time you access a page, a lot of code will run that
> won't need to run on subsequent loads of the same page. There will be
> code in PresentationServer but also code in the VM itself (loading
> libraries, JIT compiling code ...).
>
> Getting back to your question, there is nothing in PresentationServer
> at this point to pre-load pages. The <load-on-startup> should be set,
> but it won't help much as it will just make sure that the servlet is
> loaded.
>
> Alex
>
> On 3/16/06, Adrian Baker <[hidden email]> wrote:
> > After a fresh restart/redeploy, the very first form loaded through OPS
> > is very slow (up to 10 seconds). After this first rendering, all forms
> > load very fast - it's only the first load that's problematic, presumably
> > as the engine initializes itself.
> >
> > Is this something that others have observed? Is there a way OPS can be
> > 'primed' at start up so that there isn't a delay visible to the user?
> > Perhaps I could construct a http request server side and fire this at
> > OPS, but this feels a little... hacky. I might try it in the interim,
> > but perhaps as a better solution do pipelines need something like a
> > <load-on-startup> tag similar to the servlet tag that can be specified
> > in web.xml?
> >
> > Adrian
> >
> >
> >
> >
> > --
> > You receive this message as a subscriber of the [hidden email]
> mailing list.
> > To unsubscribe: mailto:[hidden email]
> > For general help: mailto:[hidden email]?subject=help
> > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
> >
> >
> >
>
>
> --
> Blog (XML, Web apps, Open Source):
> http://www.orbeon.com/blog/
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: first form slow to load in OPS

Adrian Baker-2
In reply to this post by Adrian Baker-2
For the record, I wrote a 'primer' servlet which on initialisation
constructs a org.springframework.mock.web.MockHttpServletRequest and
uses the Orbeon Processor API to send this request to a pipeline.
(Forwarding the mock request to the OPS servlet using the servlet
container didn't work. Forwarding a request creating using HttpClient
forwarding *did* work, but you can't set request attributes on these
requests which I needed to do).

    public void init(final ServletConfig config) throws ServletException {
        super.init(config);

        final MockHttpServletResponse response = new
MockHttpServletResponse();
        final MockHttpServletRequest request = new
MockHttpServletRequest(config.getServletContext());

        final ProcessorDefinition processor = new ProcessorDefinition();
        processor.setName(new QName("pipeline",
XMLConstants.OXF_PROCESSORS_NAMESPACE));
        processor.addInput("config",
"oxf:/orbeon/render-form-from-request.xpl");

        request.setAttribute("form", {any dummy XHTML+XForms DOM here});
       
        final PipelineContext pipelineContext = new PipelineContext();
        PipelineEngineFactory.instance().executePipeline(
                processor,
                new ServletExternalContext(getServletContext(),
pipelineContext, new HashMap(), request,
                        response), pipelineContext,
ProcessorService.logger);
    }

(render-form-from-request.xpl simply uses the scope-generator to extract
the form from the request and hand it to epilogue.xpl for rendering.)

In web.xml this servlet gets a <load-on-startup> of 2 as opposed to 1
for the OPS servlets, to ensure OPS is initialised before this code is
run. Although I don't particularly like using a mock object library in
production code, it works without relying on any sort of timer. No doubt
there are other approaches as well though.

Adrian


Adrian Baker wrote:

> After a fresh restart/redeploy, the very first form loaded through OPS
> is very slow (up to 10 seconds). After this first rendering, all forms
> load very fast - it's only the first load that's problematic,
> presumably as the engine initializes itself.
>
> Is this something that others have observed? Is there a way OPS can be
> 'primed' at start up so that there isn't a delay visible to the user?
> Perhaps I could construct a http request server side and fire this at
> OPS, but this feels a little... hacky. I might try it in the interim,
> but perhaps as a better solution do pipelines need something like a
> <load-on-startup> tag similar to the servlet tag that can be specified
> in web.xml?
>
> Adrian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws