|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Jetty and Reverse Ajax PerformanceAfter reading Joe's weblog post about DWR & Jetty continuations work:
http://getahead.org/blog/joe/2007/03/01/what_is_the_hardest_coding_problem_you_ever_tackled.html I decided to try again to use ReverseAjax with Jetty 1.6 and the latest DWR from CVS. If I just have a single connection with the long running connection, then the data doesn't get sent to me until the connection timeout, which was upped from 30 seconds to 60 seconds, so things look worse! However (long story on how I figured this out), if I add an empty method on my DWR object, and constantly poll (every 0.5 seconds) calling them method, then the data on the reverse-ajax connection is received immediately. I assume this has something to do with the server load monitor & such (not familiar with the code base)? Details: I have an class exposed by DWR (from Spring) that has the following methods: private void test() { if (this.serverContext == null) { this.serverContext = ServerContextFactory.get(WebContextFactory.get().getServletContext()); Thread test = new Thread() { public void run() { while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { // do nothing } final ScriptBuffer script = new ScriptBuffer(); script.appendScript("test("); script.appendData(System.currentTimeMillis()); script.appendScript(");"); // Loop over all the users on the current page final Collection<ScriptSession> sessions = AjaxDemonstrationService.this.serverContext.getAllScriptSessions(); for (final ScriptSession session : sessions) { session.addScript(script); } } test.start(); } public void ping() { if (this.serverContext == null) { this.serverContext = ServerContextFactory.get(WebContextFactory.get().getServletContext()); } } On the page I have something like this (from memory of testing code left at work): <script type="text/javascript"> function init() { dwr.engine.setActiveReverseAjax(true); MyDWRObject.ping(loop); } var loop = function() { setTimeout("MyDWRObject.test(loop)", 500); } function test(test) { alert(test); } </script> If I get rid of the loop part, then it takes 60 seconds before my test function is called. With the loop, I get results immediately. Any advice on something else I should try? If not, and it's something that can be fixed in DWR, I hope this provides enough information to help. -- Stephen Duncan Jr www.stephenduncanjr.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Jetty and Reverse Ajax PerformanceSo the ping is simply giving at alternate way for DWR to send the data back. Jetty is working just fine for me, it's one of my test cases. Do you have firebug installed? Could you turn the ping off (if you have a look at the XHR traces in the console you'll see them carrying the reverse ajax traffic) Could you turn DWR debug on so you can see the reverse ajax debug on the way out (there is an example log4j file in the war that has an example IIRC) The verify that jetty thinks it has sent the script, but that the browser has not done anything about it. Thanks, Joe. On 3/8/07, Stephen Duncan <stephen.duncan@...> wrote: After reading Joe's weblog post about DWR & Jetty continuations work: |
|
|
Re: Jetty and Reverse Ajax PerformanceFrom what I can tell from turning on debug logging for
org.directwebremoting, nothing is being written, until the 60 seconds is up, and then it's all written out at once. Extra info: I'm using Jetty 6.1.1, in embedded mode. Here's the section creating the server: final Server server = new Server(); final SelectChannelConnector selectChannelConnector = new SelectChannelConnector(); selectChannelConnector.setPort(Integer.parseInt(configuration.getProperty("port"))); server.addConnector(selectChannelConnector); Here's the section adding the DWRSpringServlet: final ServletHolder dwrServletHolder = new ServletHolder(new DwrSpringServlet()); dwrServletHolder.setInitParameter("pollAndCometEnabled", "true"); dwrServletHolder.setInitParameter("debug", "true"); final Context root = new Context(server, "/", Context.SESSIONS); root.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); root.addServlet(dwrServletHolder, "/dwr/*"); -Stephen On 3/8/07, Joe Walker <joe@...> wrote: > > So the ping is simply giving at alternate way for DWR to send the data back. > Jetty is working just fine for me, it's one of my test cases. > > Do you have firebug installed? > > Could you turn the ping off (if you have a look at the XHR traces in the > console you'll see them carrying the reverse ajax traffic) > Could you turn DWR debug on so you can see the reverse ajax debug on the way > out (there is an example log4j file in the war that has an example IIRC) > The verify that jetty thinks it has sent the script, but that the browser > has not done anything about it. > > Thanks, > > Joe. > > > > On 3/8/07, Stephen Duncan <stephen.duncan@...> wrote: > > > > After reading Joe's weblog post about DWR & Jetty continuations work: > > > http://getahead.org/blog/joe/2007/03/01/what_is_the_hardest_coding_problem_you_ever_tackled.html > > I decided to try again to use ReverseAjax with Jetty 1.6 and the > > latest DWR from CVS. > > > > If I just have a single connection with the long running connection, > > then the data doesn't get sent to me until the connection timeout, > > which was upped from 30 seconds to 60 seconds, so things look worse! > > However (long story on how I figured this out), if I add an empty > > method on my DWR object, and constantly poll (every 0.5 seconds) > > calling them method, then the data on the reverse-ajax connection is > > received immediately. I assume this has something to do with the > > server load monitor & such (not familiar with the code base)? > > > > Details: > > > > I have an class exposed by DWR (from Spring) that has the following > methods: > > > > private void test() { > > if (this.serverContext == null) { > > this.serverContext = > > ServerContextFactory.get(WebContextFactory.get().getServletContext()); > > Thread test = new Thread() { > > public void run() { > > while (true) { > > try { > > Thread.sleep(1000); > > } catch (InterruptedException e) { > > // do nothing > > } > > > > final ScriptBuffer script = new ScriptBuffer(); > > script.appendScript("test("); > > script.appendData(System.currentTimeMillis()); > > script.appendScript(");"); > > > > // Loop over all the users on the current page > > final Collection<ScriptSession> sessions = > > > AjaxDemonstrationService.this.serverContext.getAllScriptSessions(); > > for (final ScriptSession session : sessions) { > > session.addScript(script); > > } > > } > > > > test.start(); > > } > > > > public void ping() { > > if (this.serverContext == null) { > > this.serverContext = > > ServerContextFactory.get(WebContextFactory.get().getServletContext()); > > } > > } > > > > On the page I have something like this (from memory of testing code > > left at work): > > > > <script type="text/javascript"> > > function init() { > > dwr.engine.setActiveReverseAjax(true); > > MyDWRObject.ping(loop); > > } > > > > var loop = function() { > > setTimeout("MyDWRObject.test(loop)", 500); > > } > > > > function test(test) { > > alert(test); > > } > > </script> > > > > > > If I get rid of the loop part, then it takes 60 seconds before my test > > function is called. With the loop, I get results immediately. Any > > advice on something else I should try? If not, and it's something > > that can be fixed in DWR, I hope this provides enough information to > > help. > > > > -- > > Stephen Duncan Jr > > www.stephenduncanjr.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > users-unsubscribe@... > > For additional commands, e-mail: users-help@... > > > > > > -- Stephen Duncan Jr www.stephenduncanjr.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Jetty and Reverse Ajax PerformanceI'm attempting to attach a zip file with a simple project showing off my problem. I'm posting through Nabble at the moment, so hopefully the file will come through...
It's a Maven project. You can run it by: mvn assembly:directory java -jar target/dwrtest-1.0-SNAPSHOT/dwrtest-1.0-SNAPSHOT/dwrtest-1.0-SNAPSHOT.jar Or through eclipse after running mvn eclipse:eclipse - Stephen dwrtest.zip |
|
|
Re: Jetty and Reverse Ajax PerformanceIn case you didn't see it at the bottom of the e-mail, the zip link is here: http://www.nabble.com/file/7064/dwrtest.zip
-Stephen
|
|
|
Re: Jetty and Reverse Ajax PerformanceOK - i see your problem. I'll take a look.
Joe. On 3/9/07, jrduncans <stephen.duncan@...> wrote: > > In case you didn't see it at the bottom of the e-mail, the zip link is here: > http://www.nabble.com/file/7064/dwrtest.zip > > -Stephen > > > jrduncans wrote: > > > > I'm attempting to attach a zip file with a simple project showing off my > > problem. I'm posting through Nabble at the moment, so hopefully the file > > will come through... > > > > It's a Maven project. You can run it by: > > > > mvn assembly:directory > > java -jar > > target/dwrtest-1.0-SNAPSHOT/dwrtest-1.0-SNAPSHOT/dwrtest-1.0-SNAPSHOT.jar > > > > Or through eclipse after running mvn eclipse:eclipse > > > > - Stephen > > > > > > Joe Walker-3 wrote: > >> > >> So the ping is simply giving at alternate way for DWR to send the data > >> back. > >> Jetty is working just fine for me, it's one of my test cases. > >> > >> Do you have firebug installed? > >> > >> Could you turn the ping off (if you have a look at the XHR traces in the > >> console you'll see them carrying the reverse ajax traffic) > >> Could you turn DWR debug on so you can see the reverse ajax debug on the > >> way > >> out (there is an example log4j file in the war that has an example IIRC) > >> The verify that jetty thinks it has sent the script, but that the browser > >> has not done anything about it. > >> > >> Thanks, > >> > >> Joe. > >> > >> > >> On 3/8/07, Stephen Duncan <stephen.duncan@...> wrote: > >>> > >>> After reading Joe's weblog post about DWR & Jetty continuations work: > >>> > >>> http://getahead.org/blog/joe/2007/03/01/what_is_the_hardest_coding_problem_you_ever_tackled.html > >>> I decided to try again to use ReverseAjax with Jetty 1.6 and the > >>> latest DWR from CVS. > >>> > >>> If I just have a single connection with the long running connection, > >>> then the data doesn't get sent to me until the connection timeout, > >>> which was upped from 30 seconds to 60 seconds, so things look worse! > >>> However (long story on how I figured this out), if I add an empty > >>> method on my DWR object, and constantly poll (every 0.5 seconds) > >>> calling them method, then the data on the reverse-ajax connection is > >>> received immediately. I assume this has something to do with the > >>> server load monitor & such (not familiar with the code base)? > >>> > >>> Details: > >>> > >>> I have an class exposed by DWR (from Spring) that has the following > >>> methods: > >>> > >>> private void test() { > >>> if (this.serverContext == null) { > >>> this.serverContext = > >>> ServerContextFactory.get(WebContextFactory.get().getServletContext()); > >>> Thread test = new Thread() { > >>> public void run() { > >>> while (true) { > >>> try { > >>> Thread.sleep(1000); > >>> } catch (InterruptedException e) { > >>> // do nothing > >>> } > >>> > >>> final ScriptBuffer script = new ScriptBuffer(); > >>> script.appendScript("test("); > >>> script.appendData(System.currentTimeMillis()); > >>> script.appendScript(");"); > >>> > >>> // Loop over all the users on the current page > >>> final Collection<ScriptSession> sessions = > >>> AjaxDemonstrationService.this.serverContext.getAllScriptSessions(); > >>> for (final ScriptSession session : sessions) { > >>> session.addScript(script); > >>> } > >>> } > >>> > >>> test.start(); > >>> } > >>> > >>> public void ping() { > >>> if (this.serverContext == null) { > >>> this.serverContext = > >>> ServerContextFactory.get(WebContextFactory.get().getServletContext()); > >>> } > >>> } > >>> > >>> On the page I have something like this (from memory of testing code > >>> left at work): > >>> > >>> <script type="text/javascript"> > >>> function init() { > >>> dwr.engine.setActiveReverseAjax(true); > >>> MyDWRObject.ping(loop); > >>> } > >>> > >>> var loop = function() { > >>> setTimeout("MyDWRObject.test(loop)", 500); > >>> } > >>> > >>> function test(test) { > >>> alert(test); > >>> } > >>> </script> > >>> > >>> > >>> If I get rid of the loop part, then it takes 60 seconds before my test > >>> function is called. With the loop, I get results immediately. Any > >>> advice on something else I should try? If not, and it's something > >>> that can be fixed in DWR, I hope this provides enough information to > >>> help. > >>> > >>> -- > >>> Stephen Duncan Jr > >>> www.stephenduncanjr.com > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: users-unsubscribe@... > >>> For additional commands, e-mail: users-help@... > >>> > >>> > >> > >> > > http://www.nabble.com/file/7064/dwrtest.zip dwrtest.zip > > > > -- > View this message in context: http://www.nabble.com/Jetty-and-Reverse-Ajax-Performance-tf3366524.html#a9394546 > Sent from the DWR - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |