Winstone vs Tomcat - performance

Could someone help me understand or rather provide a comparison between using winstone vs tomcat from both functionality perspective as well as performance perspective.

Winstone is an old servlet-container. It is not maintained anymore (last release was in January 2008) and only supports servlet api 2.5.
As a feature comparison, Tomcat supports servlet api 3.1 (and support of servlet api 4.0 is on the way). Tomcat is the most used servlet container in the world and well maintained.
For performance comparison between Tomcat and Winstone, I do not know of a benchmark but I would put trust in the most used and tested (ie Tomcat).
Between Tomcat and Winstone, the choice is fast.
Note: Winstone was known to be a lightweight servlet container embedded in Jenkins. But Jenkins has replaced it by embedded Jetty a long time ago.

Related

Jersey Support is Jersey 2.35 not Jersey 3.x

I have a server I built a few years ago which provides both REST endpoints and websocket.
It packages as a jar file (as opposed to war) with an embedded Jetty server. Rest is provided by Jersey(2.26). Jersey and JEE Websocket are each ContextHandlers configured into Jetty. The server was built on Java 8.
I want to update the server. My main goals of the update is move to Java 17 and from JEE->Jakarta.
I just found Helidon and thought it to be the perfect solution, particularly since it even has an example of a server that combines REST and websocket.
As I started working with Helidon I found to my disappointment that helidon-webserver-jersey pulls in Jersey2.35 (JEE) not Jersey3.x (Jakarta).
I know that Jersey is doing parallel development in 2.x and 3.x, but I'm still surprised that something as new as Helidon connects to 2.x not 3.x.
I'm curious what the reasoning was behind that decision and if there are plans in the near future to move to Jersey3.x
I haven't started on the websocket piece yet, but I'm guessing its JEE not Jarkata as well. Is that true?
Jersey 3.x as well as the full "jakartification" of Helidon will come with version 3.x.
3.0.0-M1 is already available: https://medium.com/helidon/helidon-3-0-0-m1-release-7dad655cd469

Using Spring Aspects with Jetty

I have an application that uses Aspects with Spring 3.1. It runs perfectly with Tomcat 7. The advised methods get called as expected.
I want it to work with Jetty. I've previously used Aspects with Spring 2.0 and Jetty with no major problems apart from adding a JVM agent. However I've had no luck with Jetty 6.22 and my Spring 3.1 application. I start Jetty with the javaagent thus
-javaagent:./spring-instrument-3.1.3.RELEASE.jar
where the Spring Instrument jar is in my CWD.
There is a similar question on StackOverFlow but no-one was able to come up with a working answer.
First of all, I'd highly recommend to use jetty 9 instead of jetty 6. Jetty 6 is End of Lifetime since a while now and it's missing lots of features and bugfixes!
Besides that, are you using the --exec option somewhere in your configs? That will start a second jvm and probably that second jvm is not started with the javaagent setting place. You could verify that with "ps -ef | grep jetty" on *nix systems.

Using Felix within a Servlet 3.0 server (like Tomcat 7)

I'm converting an application to an OSGi environment.
This application uses asynchronous servlets (so Servlet 3.0.0+) to detach the incoming requests from their thread, and queue the requests.
As far as I can see, all servlet bridged Felix packages use servlet 2.x, so I can not use servlet 3.0 specific stuff.
Is that true? Is there any way to use asynchronous servlets in Felix? If not, is it
planned?
I've tried both Felix and Equinox.
Felix turned out to be pretty easy, it's mostly a matter of injecting the Servlet 3.0 package to the framework, from then on there aren't any servlet 2.0 dependencies.
Note that the examples on the felix site aren't completely up to date.
Anyway: I've shared an example on github, maybe it's useful for somebody:
https://github.com/flyaruu/felix-bridge
As an alternative to a servlet bridge it might be worth looking at Eclipse Virgo. The latest release of that currently includes Tomcat 7 and I believe the 3.5 release will use Jetty 8, so that would give you your servlet 3.0 support in an OSGi environment.

Any issues migrating from JDK6 to JDK7 with Spring & Tomcat?

I'd like to take advantage of some JDK7 features. What issues might I run into given that I use Apache Tomcat 7.0.x (latest) and Spring 3.1 (latest)?
There were a few compilation gotchas where JDK 6 could infer the generic type properly where JDK 7 could not. This was apparently a bug in JDK 6 as referenced here.
If you are using container-specific resources (e.g., data sources, etc.) be sure to verify these are still operating properly (though this will be immediately obvious on Spring startup if any of these are wired in).
If you are using Spring Security, and you upgrade, you do not need to make any changes per se to get get things running. However, you should take advantage of their less verbose configuration options (especially for REST URL's) that are available in Spring Security 3.1.
Other than that, our upgrade was seamless.
With the last Ubuntu update (11.10) I switched to JDK 7 (OpenJDK 1.7.0_147). I'm using Spring 3.0, Tomcat 6, and JRE 6 on the server (we have both VM and "physical" server installations). The code, compiled with JDK 7 runs on this configuration without any problems. I'm sure, switching to Spring 3.1 won't cause any changes. Not so sure about Tomcat 7, but hopefully this information will be useful to you.
You might run into a problem if you're using Java 7 features in a JSP. Tomcat by default user Java 1.6 for JSP compilation. See http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html#Production%20Configuration
To solve the problem you'll want to override the compilerSourceVM and compilerSourceVM init parameters in your application's web.xml file. More on that here: https://stackoverflow.com/a/20194823/1029261

Enterprise Application

I am thinking about a platform for study application (it is team work). I mean standard Java EE 5 (or maybe try raw Java EE 6) and Spring. What is your choose? (I don't mean Spring MVC but Spring Beans and EJB 3.0)
Also I would like to know what app server you use? (now I use GlassFish v2)
I would recommend Spring without EJBs.
My favorite choice of Java EE app server is WebLogic, but I don't know if Oracle is as generous as BEA was about making it available to developers.
I'd recommend using Tomcat as your app server. If you need JMS, add ActiveMQ.
As duffymo says, look at Spring without EJBs. Spring is very powerful, regardless of how much/little you use. I don't know of anyone using EJBs now. Having said that, EJBs have changed dramatically over the years, and now resemble ORMs such as Hibernate (which is worth checking out in itself).
For app servers, check out JBoss. It's free/open-source, and you can choose the web component between Tomcat and Jetty. It's JMX backbone allows you to easily monitor its state and to integrate your own JMX beans into that backbone (if you're using Spring, you can JMX-enable any bean with a simple configuration).
If you want Java EE 6 then the choice appears to be either Glassfish 3 or the beta of JBoss 6. As some of the others have said, I also prefer Spring to Java EE's EJBs.
I don't see much point in looking at Java EE 5, unless you think you will be working with it in the future (possible as some companies are conservative in using newer versions of technology).

Resources