Open GoogleCodeExporter opened 9 years ago
This is actually something undocummented and that will need to be reviewed.
Batching is currently supported.
http://code.google.com/docreader/#p=gwt-dispatch&s=gwt-dispatch&t=CompoundAction
s
Almost nothing have changed from this.
Original comment by goudreau...@gmail.com
on 11 Jul 2010 at 3:50
I'm familiar with BatchActions, but what I think what they are talking about is
automatic batching of actions. Different parts of the UI (that don't know
about each other) all make requests, but instead of making the request they are
put in a queue a DeferredCommand is used to "take all the requests that have
been batched up by different parts of the UI, and it fires them off to the
server to be handled."
BatchCommand requires the developer to batch actions together. What I'm
suggesting is that gwt-platform does the automatic batching of requests.
Original comment by brendanp...@gmail.com
on 11 Jul 2010 at 7:46
Here is a quick hack I made to DefaultDispatchAsync. I hope it shows roughly
what I'm intending to achieve.
The code doesn't compile, as it has a 'Bound Mismatch' problem.
Original comment by brendanp...@gmail.com
on 11 Jul 2010 at 8:35
Attachments:
I checked your patch, I like the idea, but it does get rid of the principle
that actions can have different entry point URLs. So:
1) Do we try to reconcile both features? (i.e. we could keep a different queue
for each entry point URL)
2) Do we drop support for different entry point URLs?
3) Do we make auto-batching incompatible with different entry point URLs?
Also, I haven't tried applying it, but what is causing this 'Bound Mismatch'
problem?
Original comment by philippe.beaudoin
on 12 Jul 2010 at 7:02
1) I don't know, I really like the way rpc calls are made. Batching manually
when I can.
2) No.
3) If we do this, we could make something up that will create a batching action
sting like URL.
4) Queueing is something that we should support. If not automatic, at least
manually. Something like :
dispatcher.addToQueue(new action, new asynccallback);
dispatcher.commitQueue().
I have to say that I have no idea if we can make the assumption that the
automatic queue will be called when I want as a developer and I have some cases
where it would be awesome to be able to control when and how it works.
Original comment by goudreau...@gmail.com
on 12 Jul 2010 at 12:20
[deleted comment]
Did you forget to bind BatchActionHandler ?
Original comment by goudreau...@gmail.com
on 12 Jul 2010 at 12:44
I have never run into a situation requiring autobatching, but I can imagine
some cases where it's usefule. Brendan, can you give us an example where it
would have made your life easier?
I don't think autobatching would produce any behavior change from the point of
view of the user -- beside a performance/memory hit. As such, I'm not a big fan
of adding methods to the API as proposed by Christian in (4). Maybe a global
switch to turn autobatching on/off on a specific entry point URL?
My proposition for now:
- Do autobatching in a subclass (i.e. AutoBatchingDispatchAsync)
- Let the user bind the default or autobatching version (i.e. if he wants to
save memory)
- When using AutoBatching, the user has to explicitely enable autobatching on
specific entry point urls, say via a call to
enableAutoBatching("/my/entrypoint/url")
- AutoBatchingDispatchAsync instantiates 1 queue for each enabled entry point
URL.
The only thing I'm not sure about is the 1st step (I'm not even sure there is a
real performance/memory cost due to GWT's optimized compilation).
Original comment by philippe.beaudoin
on 12 Jul 2010 at 5:22
Forgot to add:
- If an action is fired with an entry point url that is not autobatched, it is
sent right away to the server.
Original comment by philippe.beaudoin
on 12 Jul 2010 at 5:23
/Maybe a global switch to turn autobatching on/off on a specific entry point
URL?
Just one clarification, I was talking about manually Queuing, when you need an
action to be done and have the result before firing the next one. And for that,
yes a simple override with a true/false statement would be awesome.
Batching could be done in the same way. We could even bind the default boolean
values with gin instead of having to add a parameter to every execute.
Original comment by goudreau...@gmail.com
on 12 Jul 2010 at 5:39
[deleted comment]
I don't have a personal example, but listened to the Google I/O sessions and
thought we can learn from Google's experience. If you listen to the Google I/O
session I linked to, the aussie guy said he needed it to fix performance issues
in Google Wave. Say you were rewriting gmail, on application startup the inbox
presenter will want to grab the first page of the inbox, and the menu presenter
will want to grab the total unread emails. Each of these presenters can avoid
knowing about each other. Any yet only make one http connection.
I think autobatching is a performance enhancement (to avoid hitting the limit
on http connections - mobile browser have a limit of 2, old browser limit of
4), and it would probably make it harder to debug. So we don't want to force
it on everyone.
I see 3 switches to choose from:
- global, either all on or all off.
- per action, each action defines an boolean autoBatch() function.
- per call, dispatcher.executeDelayed(...)
The reason for autobatching instead of manual batching is reduced coupling.
One part of the application doesn't have to know that another part of the
application is requesting information.
My patch had issues mainly as I only had a short time to code it, and I just
wanted to get the concept out for discussion. I don't expect any of the code
to be used anyway.
Original comment by brendanp...@gmail.com
on 12 Jul 2010 at 8:03
Yeah and in the cases you need gwt-comet on one connection, you have one
connection left for those poor little mobile browsers :)
Original comment by goudreau...@gmail.com
on 12 Jul 2010 at 8:03
such a dispatcher should support many strategies, like commiting, as mentioned
above or my favourite would be auto-sensing, where the dispatcher waits for a
certain period of time after last dispatch instruction which is queued but not
executed. after certain timeout of being idle, dispatcher would transmit them
as a batch and proceed callback execution
Original comment by eplisc...@gmail.com
on 18 Aug 2010 at 10:08
Original comment by philippe.beaudoin
on 22 Sep 2010 at 1:40
Original comment by bren...@doherty.net.nz
on 6 Oct 2010 at 9:52
Original issue reported on code.google.com by
brendanp...@gmail.com
on 11 Jul 2010 at 10:36