Same disclaimer as last time : This is not a real benchmark ! so I’ll copy paste the paragraph I wrote last time :
In this test I’m just concerned about the usability of an application server for a developer. The idea is to download it, install it, start it and take some measurements : size of download, ease of installation, size of disk, startup time, size of RAM... That’s all. No deployment of an application, no fancy twists to gain performance… Because some of these application servers are resource consuming, I’m doing all my tests on a Windows XP SP3 virtual machine (running on Virtual Box 4.1). It is a fresh install of Windows XP sp3 with 1Gb of RAM and not too many software installed. So when I boot there are 27 processes running and using 230 Mb of RAM (leaving 770 Mb free). Virtualizing can be slower, so keep in mind that startup time can be a bit faster that what I’m giving you here. I use JDK 1.6.0_27 (when it’s not bundled with the server). No optimization at all is made (I haven’t twisted the JVM, or antyhing application server parameter, everything comes out of the box).
To calculate the startup time, I don’t do any fancy rocket science either. I just start the server a few times, check how long it takes and use the best startup time. Also remember that some servers do not load any container at startup, making them very fast to start. That’s why I first trigger the web admin console (when there’s one) so I’m sure at least one web application is deployed (I did a print screen of the admin console when there’s one). Then I just stop and start the server a few times and get the best startup time (by reading the logs). To calculate the memory footprint, I just use the Windows task manager and check the size of the java.exe process.
GlassFish 3 is the open source reference implementation for Java EE 6. The 3.1 release has added clustering capabilities. Being the reference implementation, GlassFish 3.x implements both Java EE 6 and the Web Profile 1.0, that’s why you have two different bundles you can download (one of 80.6 Mb and the other 45.8 Mb).
Resin 4 was one of the first web server (such as Jetty or Tomcat) to move to the Web Profile 1.0. For me it’s the success story that confirmed that profiles in Java EE were needed. It’s really difficult to go from a Web Server to a full Java EE 6 application server (remember that there’s still Entity CMPs in EE 6) but much easier to implement the Web Profile. Resin is very CDI centric and based on the Caucho implementation calledCanDI.
It looks likeJBoss 7is, finally, a nice millésime. For those of you who waited so long for JBoss 5 to get certified and then didn’t see any JBoss 6, JBoss 7 is what you need with a fantastic startup time compared to the older versions (in myprevious benchmardJBoss 5 was the slowest app servers, slower than WebSphere 7). Another novelty is an admin console (sexier than the good old JMX Console).
Like Resin,Apache TomEEis the perfect success story for the Web Profile. TomEE is no more than Tomcat + OpenWebBeans + OpenEJB + OpenJPA + MyFaces + other bits. It really shows that Java EE is a jigsaw puzzle where you can take open standards, bundle them together and become a certified Web Profile application server.
(*) Looks like to be able to log on to the admin console, you need to change the %TOMCAT_HOME%\conf\tomcat-users.xml configuration files and add a manager-script role to a user. But I couldn’t make it work.
Geronimo v3.0-M1
Geronimo is not already Java EE 6 ceritified (still in Miletone 1). Geronimo comes in 2 flavours, one with Jetty the other one with Tomcat. And like TomEE, Geronimobundles several open source implementationsof Java EE.
JOnASis till not Java EE 6 certified. It provides a full Java EE 5 execution stack plus some Java EE 6 previews (JPA 2.0, CDI, …), supporting EJB3 (and not EJB 3.1 yet).
Siwpas (Simple Web Profile Application Server) is quite new compared to the good old application servers. But like most of them, it embeds well known open source stacks, most from Apache (Tomcat, OpenEJB, OpenWebBeans, MyFaces, OpenJPA, Apache BeanValidation). It’s open source but you’ll still need a 30 days trial license to startup the enterprise version of the server.
Websphere 8is the Java EE 6 application server of IBM. Like the previous versions, you need a big bandwith to download one gigabyte of modules that get installed in nearly 2 hours. I noticed that there is a developer editionbut once installed it looks like the 2.2 Gb of the full server (I might got lost in the maze of the IBM website). There is also aCommunity Editionand it looks like it’s based onGeronimo (and the executable to install it is also 116 Mb). IBM, please, make it simple.
Thanks to @sebsto I found a gem : it looks like IBM is working on a version WAS 8.5 Alpha that would look like the other app servers (light and easy to install). I’ll stay tuned on this one.
A bit unknown but in version 7.0 (so it shows this application server has been around for long time), Jeus 7from TMaxSoft was a bit difficult to startup (create an account on the web site, download, install, run a wizard and read the README.txt to make it started). Then I discovered that there is no Jeus 7 for Windows so I downloaded the Linux version and installed it on Ubuntu (so the results of the microbenchmark are not very accurate compare to the other made on Windows).
Tomcat 7 is not a Java EE 6 application server nor does it implement the Web Profile 1.0. It is just a Servlet 3.0 container, so it’s shouldn’t appear in this blog post. But, everybody likes Tomcat, everybody feels Tomcat is way much faster than any server on earth (even faster than Neutrinos or maybe not). So I had to put it in this benchmark just to be a source of comparaison. And, indeed, Tomcat is the fastest application server of the list (3 times faster than GlassFish or 4 times faster than JBoss). But it only does Servlet 3 while the others implement between 12 (Web Profile) or 28 (Java EE 6) specifications.
As a summary I will show you two graphs with startup time and resource consumption so it’s easier to compare.
Startup time
When you are a developer, startup up time matters (it doesn’t when you are in production). Thanks to tools like JRebel or the hot deployment of our IDEs, we tend to restart our app servers less and less. But, sometimes it happens (PermGens, classpath mess up, memory leaks, refreshing app server cache…). I didn’t put WAS 8 nor Jeus 7 in the graph below because they would just break the scale (42 and 23 seconds). It’s interesting to notice that 4 app servers (Resin, GlassFish, JBoss and TomEE) start in less that 5 seconds (Jonas & Geronimo are still in Milestone). Resin is 3 times slower than Tomcat, but again, it comes with the Web Profile.
Size once installed on the drive & size of process in RAM
The size of the application installed on your disk is not very accurate : some app servers come with documentation, samples… others no. But still, that gives you an overview of how big an app server can be (again, I couldn’t put WAS in this diagram as it will break the scale with its 2.2 Gb). The memory consumption is more interesting. Without any JVM or server twists, when you startup, they nearly all take less that 100Mb of RAM(see how close TomEE, GlassFish, JBoss and Siwpas are).
Conclusion
First of all, as you can see there is no Weblogic. Unfortunatelly Weblogic is the last big player to be certified Java EE 6. I don’t know the roadmap, hopefully I’ll soon be able to update this blog entry with the latest version of Weblogic. Second, this is not a real benchmark : I didn’t deploy any application nor I did some stress tests. One task I would like to do is to deploy a Java EE 6 application on all these servers and see how portable the code is. But that’s for another blog.
What did I want to show in this blog ? Well, that application servers have changed. Except for WAS, Weblogic or Jeus, all the others are fast at startup and take few resources (memory).
And why did I want to show this ? Because I’m fed up to still hear in 2011 : “Tomcat is light, Java EE app servers are not”. As you can see, in terms of startup and memory, the gap between Tomcat and Resin, GlassFish or JBoss is really small.
How is it going to affect your development life ? Do you remember when 7/8 years ago we had to mock our database accesses because we didn’t want to install a fat oracle database on our laptop ? These days are over now because we use in-memory databases such as H2 orDerby. Same thing is happening with application servers : soon app servers will be running in memory and we won’t be mocking anything. We will fire a test case, app servers and databases in memory, and that’s it. And with tools like Arquilian, it looks like this future is already happening.
Long live Java EE 6 and Java EE 6 application servers !
Almost all of enterprise applications are required to access relational databases regularly. But a problem faced with earlier technologies (such as JDBC) was the impedance mismatch (difference between object-oriented and relational technologies). A solution for this problem was introduced through the introduction of an abstract layer called Persistence layer, which encapsulates database access from the business logic. JPA (Java Persistence API) is a framework dedicated for the management of relational data (using the persistence layer) in Java applications. There are many vendor implementations of JPA used within the Java developer community. Hibernate is the most popular such implementation of JPA (DataNucleus, EclipseLink and OpenJPA are some others). The newest JPA version (JPA 2.0) is fully supported by Hibernate 3.5, which was released in March, 2010.
What is JPA?
JPA is a framework for managing relational data for Java. It can be used with applications utilizing JSE (Java Platform, Standard Edition) or JEE (Java Platform, Enterprise Edition). Its current version is JPA 2.0, which was released on 10 Dec, 2009. JPA replaced EJB 2.0 and EJB 1.1 entity beans (which were heavily criticized for being heavyweight by the Java developer community). Although entity beans (in EJB) provided persistence objects, many developers were used to utilizing relatively lightweight objects offered by DAO (Data Access Objects) and other similar frameworks instead. As a result, JPA was introduced, and it captured many of the neat features of the frameworks mentioned above.
Persistence as described in JPA covers the API (defined in javax.persistence), JPQL (Java Platform, Enterprise Edition) and metadata required for relational objects. State of a persistence entity is typically persisted in to a table. Instances of an entity correspond to rows of the table of the relational database. Metadata is used to express the relationships between entities. Annotations or separate XML descriptor files (deployed with the application) are used to specify metadata in entity classes. JPQL, which is similar to SQL queries, are used to query stored entities.
What is Hibernate?
Hibernate is a framework that can be used for object-relational mapping intended for Java programming language. More specifically, it is an ORM (object-relational mapping) library that can be used to map object-relational model in to conventional relational model. In simple terms, it creates a mapping between Java classes and tables in relational databases, also between Java to SQL data types. Hibernate can also be used for data querying and retrieving by generating SQL calls. Therefore, the programmer is relieved from the manual handling of result sets and converting objects. Hibernate is released as a free and open source framework distributed under GNU license. An implementation for JPA API is provided in Hibernate 3.2 and later versions. Gavin King is the founder of Hibernate.
What is the difference between JPA and Hibernate?
JPA is a framework for managing relational data in Java applications, while Hibernate is a specific implementation of JPA (so ideally, JPA and Hibernate cannot be directly compared). In other words, Hibernate is one of the most popular frameworks that implements JPA. Hibernate implements JPA through Hibernate Annotation and EntityManager libraries that are implemented on top of Hibernate Core libraries. Both EntityManager and Annotations follow the lifecycle of Hibernate. The newest JPA version (JPA 2.0) is fully supported by Hibernate 3.5. JPA has the benefit of having an interface that is standardized, so the developer community will be more familiar with it than Hibernate. On the other hand, native Hibernate APIs can be considered more powerful because its features are a superset of that of JPA.
HTML 5.0 will be the new standard for html, xhtml and DOM. HTML 5.0 was started by World Wide Consortium(W3C) and the web Hypertext Application Technology Working Group(WHATWG). HTML 5.0 reduces the need for external plugins(like Flash player). HTML5.0 provides better Error Handling. IT provides more mark upto replace scripting.
New features in HTML5.0
The video and Audio elements for media playback
The Canvas Element to draw graphic on a web page using javascript
Session and Local Storage to store data at the client side
New Structural elements like article, footer, header, nav , section…etc
New Form elements and attributes
Web Workers and Web Sockets
Geo Location
Offline application
DOCTYPE in html5.0
The declaration must be the very first thing in your HTMl 5 document, before the HTML tag.
The doctype in HTML 4.0 required a reference to a DTD but HTML 5.0 does not require a reference to a DTD.
There are 3 different doctypes In html 4.0 like strict, transitional and frameset
In HTML5.0, there is only one DOCTYPE.
Browser Support for HTML5.0
The latest browser support most of the features of HTML5.0
We can refer to the website http://www.html5test.com to know the browser support for HTML5.0
As per this website, chrome 12.0 scores 328 out of 450, Opera 11 scores 278 poins out of 400, safari 5.0 scores 212 out of 450..etc.
IE 8 is pretty far behind and score 41 out of 450.
Media tags: Video and Audio
Video Tag
Video element is used for playing videos or movies. HTML 5 video element is a standard way to include video.You can play the video without the help of external plug-ins like flash player. The content between the opening and closing tag of video is fallback content. The fallback content is displayed only by the browsers which don’t support video tag.
Syntax:
Your Browser wont support this tag
Where src attribute is used to identify the media
controls attribute is used to specify whether or not to display video controls.
Multiple Sources:
Not all browsers can support all types of video types, so video element allows you to list as many elements as you like. The browser iterates through the sources one by one until it finds one it can play. Instead of using the src attribute in the video element , use one or more elements before closing the video tag. The type attribute in video gives the type of the media resource. Type attribute will help the user agent determine if it can play this media resource before fetching it.
Example:
”>
m
Codecs in video:
The type attribute can take additional parameter called codecs, to specify which version of codecs are needed to play the video.
Example:
Video Attributes:
Attributes
Value
Description
src
url
Specify the location of the video file
height
pixels
Sets the height of the video player
width
pixels
Sets the width of the video player
controls
Boolean- any value sets this to true
If present, then the browser will display the default media controls
loop
Boolean- any value sets this to true
If present, causes the media to loop indefinitely. Video will start playing again once it is finished.
poster
url of the image file
If present, image will be displayed until the first frame of the video is downloaded
autoplay
Boolean- any value sets this to true
If present ,then the video will play automatic
preload
none, metadata, auto
Specify whether the video should be preloaded or not.
Note: preload attribute was formerly named autobuffer and the value was boolean
Audio Tag
Audio element is used for playing audio files.Audio element represents a audio or sound stream HTML 5 audio element is a standard way to include audio You can play the audio without the help of external plug-ins like flash player. Content can be given between the opening and closing of the audio tag. This content should not be shown by the user agents and is intended for the older browsers which do not support audio tag.
Syntax:
Your Browser wont support this tag
src attribute is used to identify the media
controls attribute is used to specify whether or not to display audio controls.
Multiple Sources:
Audio tag also has sources attributes where you can give multiple sources. The type attribute in video gives the type of the media resource. Type attribute will help the user agent determine if it can play this media resource before fetching it.
Note: codecs -
The type attribute can take additional parameter called codecs, to specify which version of codecs are needed to play the audio.
Attributes
Value
Description
src
url
Specify the location of the video file
controls
Boolean- any value sets this to true
If present, then the browser will display the default media controls
loop
Boolean- any value sets this to true
If present, causes the media to loop indefinitely. Video will start playing again once it is finished.
autoplay
Boolean- any value sets this to true
If present ,then the video will play automatically.
preload
None,metadata, auto
Specify whether the video should be preloaded or not.
Note: preload attribute was formerly named autobuffer and the value was boolean.
Audio tag wont support the following tags:
height
width
poster
New Form input types:
HTML 5 has introduced new input types which will help in input control and validations. You can do the basic validations like to check the email , URL syntax..etc. You can restrict the user to enter the valid inputs as per the requirements before the form is submitted. If they are not supported by the browsers they will behave as a normal text fields.
The new input types introduced in HTML 5 are :
Email
url
number
range
Date pickers (date, month, time, datetime, datetime-local )
search
color
Email:
The Email type is used with input type and should contain e-mail address. This email input type lets you to collect a valid email address. When the form is submitted , the value of the email field is automatically validated.
Syntax:
Valid: abc@xyz.com
Invaid: 1bc, abc, abc@...etc
URL:
The url type is used with input type and should contain URL address. This URL input type lets you to collect a valid URL from the user. When the form is submitted , the value of the URL field is automatically validated.
Syntax:
Valid: http://www.abc.com
Invaid: ww.abc.com, htp://www.abc.com...etc
Number:
The number type is used with input type and should contain numeric value. This type will let you collect a number(either integer or floating point). All known browser which support this number type use a spinner.
Syntax:
Valid : 100, 10.23 ..etc
Invaid: abc, a1,b100…etc
Number attributes:We can set some attributes on what numbers are accepted. Attributes used with number to put some restriction are:
Attributes
Value
Description
Max
Number
Specify the maximum value allowed
Min
Number
Specify the minimum value allowed
Step
Number
Legal number intervals (if step =2, legal no are -2, 0, 2, 4, 6, 8, etc)
Value
Number
Default value
Range:
It is used with input type and should contain a value from a range of numbers. This number type should let you collect a number(either integer or floating point). All known browser which support this range type will display a slider. Unless you use JavaScript , the exact value is not displayed to the user.
Syntax:
Range attributes: Some restriction can be set , on what numbers are accepted.Attributes of range are:
Attributes
Value
Description
Max
Number
Specify the maximum value allowed
Min
Number
Specify the minimum value allowed
Step
Number
Legal number intervals (if step =2, legal no are -2, 0, 2, 4, 6, 8, etc)
Value
Number
Default value
Date pickers
HTML 5 has several input types for selecting the date in different format depending on the requirement. At Present different browser display the date pickers in different way. For Ex: Opera uses a text field with a calendar that pops up when you click on the text field. Chrome uses something like a spinner but increments the yyyy-mm-dd , one day at a time. Earlier we used JavaScript date picker.
Syntax:
The different types of input types for selecting date and time are:
Input Types
Description
date
Selects date, month and year
month
Selects month and year
week
Selects week and year
Time
Selects time (hour and minute)
datetime
Selects time, date, month and year(UTC time)
datetime-local
Selects time , date, month and year (local time)
Search:
Search input is used for search fields like Yahoo search, Google search or Site search. We can define a textbox as search box instead of a normal text field so that it will behave as a search field. If you use type=“search , a blue cross sign appears in the text box when you type something in the search box. When you click on the cross sign, your text is cleared and you can type a new text.
Syntax:
Color:
Color input type is used for input fields that should contain a color. If you use color type , it will allow you to pick a color from the color picker. Earlier we used complex JavaScript color picker to pick a a color. Textbox should carry string like #ff0000 for red , #000000 for black color and #ffffff for White color…etc
Syntax:
Form Elements
Datalist:
The datalist elements gives a list of options for an input field. Datalist is like a dropdown list , but here the user can input anything in the textbox other then what is listed in the dropdown. To bind a datalist to an input field, list attribute of the input field should refer to the id of the datalist. The option elements should always have a value attribute.
Example
.Facebook.com" />
Output:
Output element is used for different types of output , like calculations or script output To display result of calculation on browser we use output tag.
Example:
Form Attributes
Autocomplete:
The Browser stores the forms input values if set to “on”. If this attribute us used in the form then it will be applicable to all the input types which come inside a form.We can also use the attribute with specific input type. If we don't want autocomplete for a particular input type, we need to use the value "off".
Example:
First name :
:
URL : E-mail
Employer :
Novalidate:
If this attribute is present then the form will not be validated when you click on submit button.
Example:
Name :
t type="submit"/>
E-mail : u
Note: Most of the tags work with latest version of Opera, Chrome, Firefox and IE 9.
Conclusion
In this article we saw some new features of HTML 5.0 which is supported by most of the latest browsers.