0

Why comet server-push difference of speed between 3.6.4 and 6.5.0?

asked 2012-11-27 17:15:13 +0800

claudioveryant gravatar image claudioveryant
9 1

Hi all,

this is my first post. My question is the following:
I work with Ritchlet and ZK 3.6.4 with Comet Server Push using zkmax.jar.
I want to migrate to ZK 6.5.0EE but I does not have the same fast speed of 3.6.4.

I have try also with the http://www.zkoss.org/zkdemo/server_push/comet
setting in CometServerPush.java the Threads.sleep(100) instead Threads.sleep(1000); but using ZK 3.6.4 is fast instead with ZK 6.5.0.EE we have a more long interval (seems to be 1 seconds).

The same behavior running http://books.zkoss.org/wiki/ZK_Developer's_Guide/Advanced_ZK/Long_Operations/Alternative_1:_Server_Push
setting Threads.sleep(100) instead Threads.sleep(2000) but the result is the same as the previous.
For ZK6.5.0EE I have setting in zk.xml within <device-config>:
<server-push-class>org.zkoss.zkex.ui.comet.CometServerPush</server-push-class>

My test program is IsRichletThreadServerPush.
The program creates a Thread that execute a "for" command for 10 times; in the body of "for" command we have:
that the first creates a windows. Every loop creates a Textbox and append it to the window. In the for body.
Every loop start calling "Executions.activate(dsk);" and ends with "Executions.deactivate(dsk);"

import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.GenericRichlet;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;

public class IsRichletThreadServerPush extends GenericRichlet {
public void service(Page p) {
final Desktop dsk = Executions.getCurrent().getDesktop();
final Page page = p;
if (dsk.isServerPushEnabled() == false)
dsk.enableServerPush(true);
new Thread() {
public void run() {
Window w = null;
int topwin = 30;
for (int i = 0; i < 10; i++) {
try {
Executions.activate(dsk);
System.out.println("-->Activate ["+dsk+"]");
} catch (InterruptedException e ) {
e.printStackTrace() ;
}
if (w == null) { // only the first time I create the window
w = new Window("TestServerPush", "overlapped", true);
w.setHeight("600px");
w.setWidth("600px");
w.setStyle("position:absolute;border:solid 1px;");
w.setTop(new Integer(topwin)+"px");
w.setLeft("50px");
w.setPage(page);
topwin += 20;
}
final Textbox tb = new Textbox();
tb.setStyle("position:absolute;");
tb.setLeft(new Integer(topwin + (i * 20)).toString()+"px");
tb.setTop(new Integer(topwin + (i * 30)).toString()+"px");
tb.setText(new Integer(i).toString());
tb.setParent(w);
try {
Executions.deactivate(dsk);
} catch (Exception e ) {
e.printStackTrace() ;
}
}
if (dsk.isServerPushEnabled() == false)
dsk.enableServerPush(false);
}
}.start();
}
}
The problem seems to be that the Executions.activate(desktop) get 1 second every time.

Thank in advance for all answer and happy work for all

Claudio

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-11-28 10:29:59 +0800

claudioveryant gravatar image claudioveryant
9 1

This morning I have get the zkee-bin-eval-6.5.1-FL-2012-11-27.zip from http://www.zkoss.org/download/freshly

I have tried:
- http://www.zkoss.org/zkdemo/server_push/comet;
- my IsRichletThreadServerPush.java;

and both are much much faster than zkee-bin-6.5.0.zip and is also more faster than zk3.6.4 ...

I just have to wait for the 6.5.1 official release ..

Thank

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-11-27 17:15:13 +0800

Seen: 73 times

Last updated: Nov 28 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More