Delay in data being displayed on the Browser

View: New views
1 Messages — Rating Filter:   Alert me  

Delay in data being displayed on the Browser

by vaidrahul :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
   Currently Iam having a DWR java component which has a method which writes to the browser using

browserDisplayTradeStatus(String node,Message message){
System.out.println("Inside browserDisplayTradeStatus");
ScriptBuffer script = new ScriptBuffer();
script.appendScript("displayTradeStatus("+node+","+message+")");
session.addScript(script);
}

This message is an object of Data Object class ( called Message) which has various getters-setters and the entry for the same has been made in dwr.xml
Whenever this function is invoked ,the js function displayTradeStatus is invoked and the data object is passed to this Js function.

Now this function browserDisplayTradeStatus() is called at a very high rate ie .within a second, this can be invoked almost 10-20 times or may be
more than that.
Now the problem that Iam facing is  that even though in the logs I can see the S.O.P printed,
it takes almost 30-40 secs for the data to appear in the browser.

I tried adding maxWaitAfterWrite tag in web.xml, but even that did not help much. It was able to reduce the time 40 to 20-25 secs,
Also the data that appeared on browser was not complete. For example if I invoked the js 20 times, it got invoked only 10 times
(I had an alert in the js function).
Also just to mention my Data Object class ( ie Message) is using the
JSON Serialization methods..( Not sure whether this is impacting the performance).

Can anybody , Please suggest me something, so that I can overcome this problem.
Is the rate at which js is called too high for DWR to handle.
Please suggest.
Thanks in advance for your help.

Regards,
Rahul Vaid.