Category Archives: Articles

Performance of Comet and Simple Pipe

About one and a half months ago, I introduced Java2Script Simple Pipe, another Comet implementation. At that time, I knew there were lots of performance issues on such Comet technology. Because at that time I were busy and it was not a urgent deal for me, I didn’t write test codes to test out the performances at that moment.

Only recently, I took some tests on performance issues. And the results said Simple Pipe’s Comet implementation performs really bad!

Opening 10 Comet connections using Simple Pipe does not affect the whole server. But when I opened 20 Comet connections, the CPU usage is up to 100% quickly! It’s not a problem of the application logics. It is a matter of Comet connection.

Java2Script Simple Pipe supports switching pipe mode into query mode. It is very easy, just call a static method:

SimplePipeRequest.switchToQueryMode(250);

After switching to query mode for the pipe, I can open up to 100+ connections to the server to receive stream data back to browser. The peak of CPU usage is about 60% ~ 70%. The average CPU usage may be about 20%-30%. It is an acceptable technology with such performances under the pressure tests.

( I did not test those server with special Comet optimizations. I just tested Simple Pipe on Apache Tomcat 5.5. Maybe those Comet optimized should have a better results. )

Posted in Architecture, Articles, Comet, JavaScript | Leave a comment

Reusing: Spirit of Java2Script

The following is an article that I posted about one and a half years ago. I just repost it here, because I think Reusing Java codes and tools is my fundamental point to build Java2Script Pacemaker.

—————————————————-

There are two advances of Java2Script technologies:

  1. Reusing existed Java codes
  2. Reusing existed Java tools

It’s totally about reusing. Reusing is the most important things in the programming world: source codes reusing, binary library reusing, model pattern reusing, framework reusing. Without reusing, it will mean that everyone should have to re-inhevent the wheel and then we will always stay in the stage of round wheels. Thanks to the reusing, we have great world now.

Java2Script Pacemaker is developed to give developers a toolkit of reusing existed codes and tools. And Java2Script Pacemaker is reusing other codes and tools:

  1. J2S is reusing Eclipse JDT (J2S won’t exist without JDT)
  2. J2S is reusing Java SDK’s java.* sources
  3. J2S is reusing SWT sources and models (org.eclipse.swt.*) and Visual Editor

Reusing does not mean that the sources or tools should be reused without modifications. In above reusings, I extend some extension points of JDT to given new functions, and I modify parts of the sources java.* so that the generated JavaScript is simple, and I have to reinvent the SWT Widgets inside Browser beside reusing the Events and Layouts of SWT.

Reusing already saves me a lot of time. Without JDT, I won’t have the abilities to parse the Java sources and building the DOM tree and binding. Without DOM tree and binding, I can’t generated the JavaScript codes. Without reusing java.* sources, I will have to spend times to re-write those complicated Map, Set and List implementations. Without org.eclipse.swt.layout.*, I will dedicate most of my time in tunning the layout! Without all these reusing, J2S and the related JavaScript version of SWT won’t come out in a short time. Thanks to the reusing.

Following is the questions and answers I am thinking these days:
Q: Does the Java2Script Pacemaker focus on reusing source codes only?
A: Always reusing source codes is the first of step of reusing others. But you should have already noticed that J2S is also reusing tools including Visual Editor and the Eclipse Platform.

Q: Is Java2Script Pacemaker have the abilities to reuse existed frameworks?
A: I think we should not make too much expectation on the JavaScript codes. But we can integrate the Java2Script Pacemaker with other existed frameworks, as Java2Script technology is still developing.

Q: Will Java2Script be hot in the future?
A: I don’t know. But I know, for sure, that reusing existed codes will save people’s efforts in the progress of converting desktop applications into web applications. And reusing will always be the spirit of programming.

Enjoy using Java2Script, enjoy reusing and keep thinking in reusing.

Posted in Articles | Leave a comment