Re: Are Wicket models loaded concurrently ?
the bug is that something does not serialize access to the page. the contract on models and components is that they always run in a single-threaded environment. this is what allows the user code to be simple and free of any synchronization logic. so whatever push/pull/whatever framework you are using - it should properly synchronize access to the page instance that owns the models. -igor On Wed, Dec 26, 2012 at 6:16 PM, Hendy Irawan wrote: > I think I just found a "bug" ... LoadableDetachableModel is potentially > non-threadsafe. > > I experience weird behavior, my concurrent models are chained (i.e. calls > other models getObject()), and my concurrent models extend > LoadableDetachableModel. The weird behavior is that sometimes (!!) the > models return null. But if debugged, they're not null. It's like a timing > and race condition problem. > > Now I think I know why. LoadableDetachableModel, upon getObject(), sets > attached=true before caling load(), which can take some time. If > getObject() gets called again, it then immediately returns the "loaded > object", which was still null (sometimes.). > > Should I report this as bug? > > On Wed, Dec 26, 2012 at 6:14 PM, Siefart, Olaf [via Apache Wicket] < > ml-node+s1842946n4655056...@n4.nabble.com> wrote: > >> Hi, >> >> A dashboard with unrelated web services is exactly the usecase of our >> christmas project (https://github.com/osiefart/wicket-christmas). >> >> @Hendy: I would not start the execution immediately upon model creation. I >> would choose a Visitor - onConfigure - Solution. Then it is possible to >> check the visibility of the component before loading data... >> >> Kindly regards, >> Olaf >> >> -Ursprüngliche Nachricht- >> Von: Serban.Balamaci [mailto:[hidden >> email]<http://user/SendEmail.jtp?type=node&node=4655056&i=0>] >> >> Gesendet: Mittwoch, 26. Dezember 2012 11:45 >> An: [hidden email] <http://user/SendEmail.jtp?type=node&node=4655056&i=1> >> Betreff: Re: Are Wicket models loaded concurrently ? >> >> Hello guys. >> For sure this would be useful. I encountered many cases where the models >> are using different unrelated web services and starting the requests in >> parallel would be a nice improvement. >> >> >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655055.html >> >> Sent from the Users forum mailing list archive at Nabble.com. >> >> - >> To unsubscribe, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4655056&i=2> >> For additional commands, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4655056&i=3> >> >> >> --------- >> To unsubscribe, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4655056&i=4> >> For additional commands, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4655056&i=5> >> >> >> >> -- >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655056.html >> To unsubscribe from Are Wicket models loaded concurrently ?, click >> here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655046&code=aGVuZHlAc29sdXZhcy5jb218NDY1NTA0NnwxNTI0Njc4NzUy> >> . >> NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > > -- > Hendy Irawan - on Twitter <http://twitter.com/hendybippo> - on > LinkedIn<http://id.linkedin.com/in/hendyirawan> > Web Developer | Bippo Indonesia <http://www.bippo.co.id/> | Akselerator > Bisnis | Bandung > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655067.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Are Wicket models loaded concurrently ?
I think I just found a "bug" ... LoadableDetachableModel is potentially non-threadsafe. I experience weird behavior, my concurrent models are chained (i.e. calls other models getObject()), and my concurrent models extend LoadableDetachableModel. The weird behavior is that sometimes (!!) the models return null. But if debugged, they're not null. It's like a timing and race condition problem. Now I think I know why. LoadableDetachableModel, upon getObject(), sets attached=true before caling load(), which can take some time. If getObject() gets called again, it then immediately returns the "loaded object", which was still null (sometimes.). Should I report this as bug? On Wed, Dec 26, 2012 at 6:14 PM, Siefart, Olaf [via Apache Wicket] < ml-node+s1842946n4655056...@n4.nabble.com> wrote: > Hi, > > A dashboard with unrelated web services is exactly the usecase of our > christmas project (https://github.com/osiefart/wicket-christmas). > > @Hendy: I would not start the execution immediately upon model creation. I > would choose a Visitor - onConfigure - Solution. Then it is possible to > check the visibility of the component before loading data... > > Kindly regards, > Olaf > > -Ursprüngliche Nachricht- > Von: Serban.Balamaci [mailto:[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655056&i=0>] > > Gesendet: Mittwoch, 26. Dezember 2012 11:45 > An: [hidden email] <http://user/SendEmail.jtp?type=node&node=4655056&i=1> > Betreff: Re: Are Wicket models loaded concurrently ? > > Hello guys. > For sure this would be useful. I encountered many cases where the models > are using different unrelated web services and starting the requests in > parallel would be a nice improvement. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655055.html > > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4655056&i=2> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4655056&i=3> > > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4655056&i=4> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4655056&i=5> > > > > -- > If you reply to this email, your message will be added to the discussion > below: > > http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655056.html > To unsubscribe from Are Wicket models loaded concurrently ?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655046&code=aGVuZHlAc29sdXZhcy5jb218NDY1NTA0NnwxNTI0Njc4NzUy> > . > NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- Hendy Irawan - on Twitter <http://twitter.com/hendybippo> - on LinkedIn<http://id.linkedin.com/in/hendyirawan> Web Developer | Bippo Indonesia <http://www.bippo.co.id/> | Akselerator Bisnis | Bandung -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655067.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: Are Wicket models loaded concurrently ?
Hi, A dashboard with unrelated web services is exactly the usecase of our christmas project (https://github.com/osiefart/wicket-christmas). @Hendy: I would not start the execution immediately upon model creation. I would choose a Visitor - onConfigure - Solution. Then it is possible to check the visibility of the component before loading data... Kindly regards, Olaf -Ursprüngliche Nachricht- Von: Serban.Balamaci [mailto:thespamtr...@gmail.com] Gesendet: Mittwoch, 26. Dezember 2012 11:45 An: users@wicket.apache.org Betreff: Re: Are Wicket models loaded concurrently ? Hello guys. For sure this would be useful. I encountered many cases where the models are using different unrelated web services and starting the requests in parallel would be a nice improvement. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655055.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Are Wicket models loaded concurrently ?
Thank you Olaf and Michael. I think this is workable... We can create an abstract base class that instead of doing load() directly, the signature would be something like: public Future load(ExecutorService executor); The async load() will execute immediately upon model creation, and during the "actual" LoadableDetachableModel.load(), it will simply wait for the future to complete (if it hasn't completed). Since there can be multiple futures executing at one time, no model is blocked by the loading of another model. That's in theory... Hopefully it will actually work as intended. :) Is there a plan to make this asynchronous model support built-in in Wicket? With asynchronous frameworks like Play and vert.x, I think Wicket needs to improve on this front too to keep itself relevant. If anyone else also have a need for this (at least there are 3 of us) I can file a ticket. Hendy On Tue, Dec 25, 2012 at 6:49 PM, michael mosmann [via Apache Wicket] < ml-node+s1842946n4655050...@n4.nabble.com> wrote: > If you want to speedup thing, you should trigger some model loading as > early as possible.. (It is too late, if a component calls > IModel.getObject() (should return the right value)). Because wicket uses > one thread per request you must use an other thread for loading. > > This way you could speedup a pageload for one user.. but not for more > than one (you have to load it anyway) .. there is a good chance to make it > worse. I think you choose a threaded model loading if most other options > failed (use a cache, change the query, ...) > > Mm:) > > > > > Hendy Irawan <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655050&i=0>> > schrieb: > > > > >Hi friends, > > > >If I have 5 Wicket (LoadableDetachable)models on a page, will Wicket > >load > >each model sequentially, or will the 5 models loaded concurrently ? > > > >We're using different servers for each database connection (MongoDB, > >Neo4j, > >etc.) so it will be a more effective use to load the models > >concurrently. > > > >Thank you. > > > > > > > >-- > >View this message in context: > > > http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655047.html > >Sent from the Users forum mailing list archive at Nabble.com. > > > >- > >To unsubscribe, e-mail: [hidden > >email]<http://user/SendEmail.jtp?type=node&node=4655050&i=1> > >For additional commands, e-mail: [hidden > >email]<http://user/SendEmail.jtp?type=node&node=4655050&i=2> > > -- > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > > -- > If you reply to this email, your message will be added to the discussion > below: > > http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655050.html > To unsubscribe from Are Wicket models loaded concurrently ?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655046&code=aGVuZHlAc29sdXZhcy5jb218NDY1NTA0NnwxNTI0Njc4NzUy> > . > NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- Hendy Irawan - on Twitter <http://twitter.com/hendybippo> - on LinkedIn<http://id.linkedin.com/in/hendyirawan> Web Developer | Bippo Indonesia <http://www.bippo.co.id/> | Akselerator Bisnis | Bandung -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655051.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Are Wicket models loaded concurrently ?
If you want to speedup thing, you should trigger some model loading as early as possible.. (It is too late, if a component calls IModel.getObject() (should return the right value)). Because wicket uses one thread per request you must use an other thread for loading. This way you could speedup a pageload for one user.. but not for more than one (you have to load it anyway) .. there is a good chance to make it worse. I think you choose a threaded model loading if most other options failed (use a cache, change the query, ...) Mm:) Hendy Irawan schrieb: > >Hi friends, > >If I have 5 Wicket (LoadableDetachable)models on a page, will Wicket >load >each model sequentially, or will the 5 models loaded concurrently ? > >We're using different servers for each database connection (MongoDB, >Neo4j, >etc.) so it will be a more effective use to load the models >concurrently. > >Thank you. > > > >-- >View this message in context: >http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655047.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org -- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
AW: Are Wicket models loaded concurrently ?
Thats true, but it is easy to use a custom model to make a concurrent or asynchronous load. We are using ASyncModels in our christmas project (https://github.com/osiefart/wicket-christmas). Kind regards, Olaf -Ursprüngliche Nachricht- Von: Chris Colman [mailto:chr...@stepaheadsoftware.com] Gesendet: Dienstag, 25. Dezember 2012 09:14 An: users@wicket.apache.org Betreff: RE: Are Wicket models loaded concurrently ? I'm pretty sure a single thread is used to service the HTTP request that results in the rendering of the page so I would expect LDMs to be loaded sequentially. >-Original Message- >From: Hendy Irawan [mailto:he...@soluvas.com] >Sent: Tuesday, 25 December 2012 1:00 PM >To: users@wicket.apache.org >Subject: Are Wicket models loaded concurrently ? > > >Hi friends, > >If I have 5 Wicket (LoadableDetachable)models on a page, will Wicket load >each model sequentially, or will the 5 models loaded concurrently ? > >We're using different servers for each database connection (MongoDB, Neo4j, >etc.) so it will be a more effective use to load the models concurrently. > >Thank you. > > > >-- >View this message in context: http://apache- >wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently- >tp4655046p4655047.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Are Wicket models loaded concurrently ?
I'm pretty sure a single thread is used to service the HTTP request that results in the rendering of the page so I would expect LDMs to be loaded sequentially. >-Original Message- >From: Hendy Irawan [mailto:he...@soluvas.com] >Sent: Tuesday, 25 December 2012 1:00 PM >To: users@wicket.apache.org >Subject: Are Wicket models loaded concurrently ? > > >Hi friends, > >If I have 5 Wicket (LoadableDetachable)models on a page, will Wicket load >each model sequentially, or will the 5 models loaded concurrently ? > >We're using different servers for each database connection (MongoDB, Neo4j, >etc.) so it will be a more effective use to load the models concurrently. > >Thank you. > > > >-- >View this message in context: http://apache- >wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently- >tp4655046p4655047.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Are Wicket models loaded concurrently ?
Hi friends, If I have 5 Wicket (LoadableDetachable)models on a page, will Wicket load each model sequentially, or will the 5 models loaded concurrently ? We're using different servers for each database connection (MongoDB, Neo4j, etc.) so it will be a more effective use to load the models concurrently. Thank you. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Are-Wicket-models-loaded-concurrently-tp4655046p4655047.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org