views:

210

answers:

4

Hey,

I am developing a simple web application which contains these 3 components:

  1. client that uses Ajax,javascript, html to display data on the browser.
  2. Java webserver that interfaces between the client and data processing entity.
  3. data processing entity, implemented in C++.

I need to decide which java webserver to use. Some options are:

a) use httpserver class in java (com.sun.net.httpserver) and create a multi-threaded process.

b) use Glassfish server and deploy the application on it that creates the webpage,etc.

c) use Jetty.

d) ?

The selection criteria for webserver is:

  1. Stability ( The process(web server) should run for days without restart)

  2. Maximum concurrent requests possible are about 200. and average case is about 30.

  3. Caching is done at the webserver and requests are served from the webserver itself if data is available or not marked dirty by the data processing entity.

Your suggestions are greatly appreciated.

Thank You. Ron.

A: 

I'd go with Tomcat.

Pablo Santa Cruz
+4  A: 

Don't use Java's Http Server class.

Glassfish is nice, but probably more than you need.

Jetty will work just fine.

Be aware that if you're using C++ and using JNI to interface with Java, any seg faults will kill the entire server (vs like an exception in pure Java, which will just kill the request and the container can recover).

Will Hartung
I intend to use java TCP sockets for IPC with the C++ entity over XML. the C++ data processing entity is independent and can run on different machines. Could you plz provide reasons for ruling out httpserver class straight away?
Ron
JAX-WS when run from J2SE uses the Sun HTTP server, and we found it had pretty horrible performance. Taking the same service and deploying it within Tomcat or Glassfish instead of a standalone J2SE app, was a night and day experience. That said, there's no reason you couldn't "embed" Jetty and use it like the Sun server (details will vary of course). That would give you a similiar "experience" to using the Sun classes. And, the one in Java 6 may well be better than the one in Java 5.
Will Hartung
thanks Will.
Ron
+1  A: 

Tomcat would be able to do this, but you should specify the requirements on the java side. For example, are you using any J2EE functionality?

For caching, would you need something like JBoss cache?

Are you using JNI for interfacing the Java to the C++ backend, or using an ESB, or some other approach?

What type of data is being cached?

Update: Based on your information, I would suggest not using Java, but use a C++ TCP based server for this communication. That way you don't have problems with the JNI/C++ interface. You can write a C++ server fairly easily, and if you use Boost libraries you will be close to the new C++ spec. For threads you can look at: http://www.boost.org/doc/libs/1_40_0/doc/html/thread.html

James Black
I intend to use java TCP sockets for IPC with the C++ entity over XML. the C++ data processing entity is independent and can run on different machines.Caching: is for data received from the C++ entity. this is the response data to client queries and gets updated maybe about once per day. e.g. list of types of users in the system.. it will be stored as an array at the webserver
Ron
Thanks James. I dont use any specific J2EE functionality.The role of this webserver is to be able to communicate over http protocol and provide access on the browser.
Ron
Then use apache, which is very stable and scalable, and write your cgi applications in C++. That was how I started my web programming. :)
James Black
+1  A: 

I used Resin for several years, and it is very good and stable 100% recommended.

OscarRyz