You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Robert Gründler <ro...@dubture.com> on 2015/06/14 11:04:41 UTC

Render multiple panels concurrently

Hi,

our backend application has a page containing ~20 panels which render health-checks of different components in our
infrastructure. Each one of these checks can take some time (~ 10 seconds) until it timeouts if the background-component
is not reachable.

Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due to the fact, that wicket can only run
one ajax request at a time on a single page, this can result in extremely long loading times until all panels are displayed.

I’ve tried to implement the panel rendering using websockets - but it seems i’m running in the same problem like the concurrent
ajax request issue - meaning that when i spawn the loading of the expensive panel in the background, which page instance
should i use to render the panel?

So my question is: Is there a way to render multiple panels concurrently in wicket? Which each panel having it’s own timeout?

regards


robert



Re: Render multiple panels concurrently

Posted by Sven Meier <sv...@meiers.net>.
Hi,

Wicket pages are single threaded, so no - you can't render multiple 
panels concurrently.

You should restructure you code so that the health checks are done 
asynchronously. The panels just check for the availability, and render 
some progress indicator as long as no data is available.

Regards
Sven

On 14.06.2015 11:04, Robert Gründler wrote:
> Hi,
>
> our backend application has a page containing ~20 panels which render health-checks of different components in our
> infrastructure. Each one of these checks can take some time (~ 10 seconds) until it timeouts if the background-component
> is not reachable.
>
> Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due to the fact, that wicket can only run
> one ajax request at a time on a single page, this can result in extremely long loading times until all panels are displayed.
>
> I’ve tried to implement the panel rendering using websockets - but it seems i’m running in the same problem like the concurrent
> ajax request issue - meaning that when i spawn the loading of the expensive panel in the background, which page instance
> should i use to render the panel?
>
> So my question is: Is there a way to render multiple panels concurrently in wicket? Which each panel having it’s own timeout?
>
> regards
>
>
> robert
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Render multiple panels concurrently

Posted by Robert Gründler <ro...@dubture.com>.
Thanks for the hint, i’ll give the FutureModel approach a try.


regards,

robert


On 14 Jun 2015 at 16:09:56, Martin Grigorov (mgrigorov@apache.org) wrote:

Hi,  

I have used [1] for similar task some times ago. I needed to make calls to  
external services which took some time. Wicket renders the components  
sequentially so the total time was the sum of all. By using FutureModel I  
reduced it to the time of the slowest external call.  
There is also a Java version at [2]. I haven't used it though.  

Another approach would be to use ComponentRenderer#renderComponent() that  
uses a temporary page. This way you can render the panels in parallel and  
then use the HTMLs as model objects of Labels  


1.  
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/model/FutureModel.scala  
2.  
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/minis-parent/minis/src/main/java/org/wicketstuff/minis/model/FutureModel.java  

Martin Grigorov  
Wicket Training and Consulting  
https://twitter.com/mtgrigorov  

On Sun, Jun 14, 2015 at 12:04 PM, Robert Gründler <ro...@dubture.com>  
wrote:  

> Hi,  
>  
> our backend application has a page containing ~20 panels which render  
> health-checks of different components in our  
> infrastructure. Each one of these checks can take some time (~ 10 seconds)  
> until it timeouts if the background-component  
> is not reachable.  
>  
> Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due  
> to the fact, that wicket can only run  
> one ajax request at a time on a single page, this can result in extremely  
> long loading times until all panels are displayed.  
>  
> I’ve tried to implement the panel rendering using websockets - but it  
> seems i’m running in the same problem like the concurrent  
> ajax request issue - meaning that when i spawn the loading of the  
> expensive panel in the background, which page instance  
> should i use to render the panel?  
>  
> So my question is: Is there a way to render multiple panels concurrently  
> in wicket? Which each panel having it’s own timeout?  
>  
> regards  
>  
>  
> robert  
>  
>  
>  

Re: Render multiple panels concurrently

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I have used [1] for similar task some times ago. I needed to make calls to
external services which took some time. Wicket renders the components
sequentially so the total time was the sum of all. By using FutureModel I
reduced it to the time of the slowest external call.
There is also a Java version at [2]. I haven't used it though.

Another approach would be to use ComponentRenderer#renderComponent() that
uses a temporary page. This way you can render the panels in parallel and
then use the HTMLs as model objects of Labels


1.
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/model/FutureModel.scala
2.
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/minis-parent/minis/src/main/java/org/wicketstuff/minis/model/FutureModel.java

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, Jun 14, 2015 at 12:04 PM, Robert Gründler <ro...@dubture.com>
wrote:

> Hi,
>
> our backend application has a page containing ~20 panels which render
> health-checks of different components in our
> infrastructure. Each one of these checks can take some time (~ 10 seconds)
> until it timeouts if the background-component
> is not reachable.
>
> Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due
> to the fact, that wicket can only run
> one ajax request at a time on a single page, this can result in extremely
> long loading times until all panels are displayed.
>
> I’ve tried to implement the panel rendering using websockets - but it
> seems i’m running in the same problem like the concurrent
> ajax request issue - meaning that when i spawn the loading of the
> expensive panel in the background, which page instance
> should i use to render the panel?
>
> So my question is: Is there a way to render multiple panels concurrently
> in wicket? Which each panel having it’s own timeout?
>
> regards
>
>
> robert
>
>
>