Read Digital Edition


ADS BY GOOGLE
Top Three Links You Must Click On


The Performance of EJB 3.0
Does Simplicity and Power Come at a Price?

We've all heard about the simplicity and power of the EJB 3.0 specification. And because this has proven to be true, we can't help but think that performance must be rather poor. After all, all that simplicity must come at a price.

With this in mind, we set out to test EJB 3.0's performance using Oracle's implementation of the specification. Although the implementation we used is a developer preview, where the focus is typically on product stability instead of performance, our expectations are that the performance will be below or in the best case the same as previous versions of the EJB specification.

We thought that the best way to test was to do a few things that developers typically do with EJB 2.1 and then try out the equivalent with EJB 3.0. This would let us compare performance rather than deal with raw numbers that probably wouldn't mean much. We tested the Data Transfer Object (DTO) design pattern, the Session façade design pattern, and the use of the Container Managed Relationships (CMR) functionality of the entity beans.

The application we used, as well as the test harness and the methodology, is described in J2EE Performance Testing by Peter Zadrozny (Expert Press, 2002). The harness is a simple dispatcher servlet that executes each discrete test case based on the JazzCat application, a catalog of jazz recordings. The database schema includes tables for bands, musicians, instruments, tracks, and albums. The application also handles the storage and retrieval sessions recording and takes of a track.

Our test environment was based on Oracle Application Server EJB 3.0 Preview (Developer Preview 3), and Sun Java HotSpot Client VM (build 1.5.0_03-b07, mixed mode, sharing). We used Oracle Database 10g Enterprise Edition Release 10.1.0.2.0. We used the default settings on all of the software.

The users were simulated with The Grinder 3.0 Beta 25 (http://grinder.sf.net), with a sample size of 5,000 milliseconds. Each test run lasted eight minutes; we ignored the first three minutes to allow the test to stabilize. Each simulated user ran a test script that called the corresponding test case 10 times. The test scripts were executed continuously in a sequential fashion for the duration of the test run. Two things are worth noting: there was a separate HTTP session for each execution of the test scripts, and there was no sleep time between each call to the test case. The latter was done to create a highly stressful situation so we could see how EJB 3.0 behaved when pushed to its limits.

To get a complete picture of the performance, we used two key indicators: Aggregate Average Response Time (AART), to reflect the end user perspective, and Total Transactional Rate (TTR) or throughput, to reflect the load on the systems involved.

We used three Dell PowerEdge 2850 computers with dual Intel Xeon (HT) at 3.4GHz with 4GB of memory, running Microsoft Windows Server 2003, Standard Edition. We used one of the computers to generate the load with The Grinder, another to run Oracle Containers for J2EE (OC4J), and the last to run the database. All three were connected to a switched network in which the only traffic was generated by the tests themselves.

Data Transfer Object
Using JazzCat application to test the DTO design pattern, we created a servlet that lists all the albums in our test database via an entity bean, where each row in the listing shows the field values of the album entity. We started the EJB 2.1 test by programming this functionality without using DTO. In this case, which we called "DTOOff", our test servlet would retrieve a list of all the album entities, and then get the individual field values for each entity via the entity's accessor methods.

Using the DTO design pattern, our test servlet, called "DTOOn", makes a single method call (getData). The entity bean constructs a corresponding DTO, loads it with the entity's field values, and returns the object to the servlet. Now the servlet can access the fields on the local object.

In EJB 3, the entity beans have been replaced by Plain Old Java Objects (POJOs) and all the traditional CRUD and query operations are performed with the Entity Manager (EM). Queries can be defined as standalone named queries, which are predefined in the bean class, or dynamic queries that can be constructed using the query method.

In the JazzCat application, the dispatch servlet of the test harness calls the corresponding test servlet, which in turn looks up the entity manager.

The entity manager then executes the named query that was defined for the Albums class. Here's the definition of this class and the named query:

@Entity
@Table(name="ALBUMS")
@NamedQuery(name="findAll",queryString="Select object(a) from Albums a")
public class Albums {
//......
}

Once the named query returns the list of all the albums, it's then printed out as an HTML table using the getter methods of Albums POJO.

We ran the tests with 15, 25, 50, 100, 150, 200, and 250 simultaneous users and we found that in both cases, response time and throughput, the difference between EJB 2.1 using DTO and EJB 3.0 was within 4%. This is within the margin of error, so for all practical purposes the performance is similar. To give you an idea of the actual performance, with 250 simultaneous users the average aggregate response time was 1,100 milliseconds and the throughput was an average 225 requests per second. This is very impressive, especially since there was no sleep time in the test scripts.

The DTOOff test case produced an AART 28% higher than DTOOn and EJB 3, and a TTR that was 19% lower. This is because each call to an accessor method on the entity bean is a transaction by itself, whereas using DTO and EJB 3, there is only one transaction. Remember to demarcate your transactions correctly to get better performance.

It's interesting to note the throughput curves for each case (see Figure 1). Remember that the TTR or throughput is a measure of system capacity as a whole (application, JVM, database, OS, hardware). The curves start by going upward, which shows the system is handling the capacity as the requests increase. Then they reach a point of stability where the system has reached its limit and the response time starts to increase dramatically. Finally, when the curves begin to fall, this is where the system can't handle any more load and things start going downhill. In this chart you can see that in all cases, the peak has been reached at 50 simultaneous users; however, on the DTOOff case performance goes downhill at 150 users, whereas EJB 3 and DTOOn hold on longer before going down. Interestingly, EJB 3 holds on a little longer by presenting 12% better throughput than DTOOn with 250 users. This is likewise for the response time, where EJB 3 has 13% better number than DTOOn with 250 users. You can say that under heavy loads, EJB 3.0 tends to perform better than EJB 2.1, at least in this test case.

About Peter Zadrozny
Peter Zadrozny is CTO of StrongMail Systems, a leader in digital messaging infrastructure. Before joining StrongMail he was vice president and chief evangelist for Oracle Application Server and prior to joining Oracle, he served as chief technologist of BEA Systems for Europe, Middle East and Africa.

About Raghu R. Kodali
Raghu R. Kodali is consulting product manager and SOA evangelist for Oracle Application Server. He leads next-generation SOA initiatives and J2EE feature sets for Oracle Application Server, with particular expertise in EJB, J2EE deployment, Web services, and BPEL. He holds a Masters degree in Computer Science and is a frequent speaker at technology conferences. Raghu is also a technical committee member for the OASIS SOA Blueprints specification, and a board member of Web Services SIG in OAUG. He maintains an active blog at Loosely Coupled Corner (www.jroller.com/page/raghukodali).

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

The performance of EJB3.0 article was so nice and also was useful for me in my research.

With Regards
D.Jeya Mala

How about testing EJB 2.1 Session Beans w/Hibernate or JDBC data access vs EJB 3.0 w/Entities. I'd expect EJB 3.0 to be faster than EJB 2.1 Entity Beans because the 2.1 version are horribly slow.

What, Oracle Application Server does not run on 64-bit JVM? :) Seriously, why are we treated with benchmarks running on yester-years' platform?

Otherwise, thanks, nice work.


  Subscribe to our RSS feeds now and receive the next article instantly!
In It? Reprint It! Contact advertising(at)sys-con.com to order your reprints!
Subscribe to the World's Most Powerful Newsletters

ADS BY GOOGLE
IBM has acquired Guardium, a seven-year-old subsidiary of Israel’s Log-On Software transplanted to M...
But on the web, access to services is implicit in the fact that the business is offering the service...
Behaving like it’s got a future, Sun Monday put out what it calls a significant new version of Virtu...
Intel has put out its promised beta SDK for Windows (C and C++) and Moblin (C) developers working on...
Berlin-based ThinPrint AG, the printer virtualization house, thinks it’s got a cloud solution for th...
InformationWeek stumbled on a Microsoft patent application dating back to 2006 deceptively titled “M...
The second set of charges filed last week against Indian outsourcer Satyam Computer Services founder...
Oracle has offered to cordon off MySQL inside a combined Oracle-Sun to get the European Commission t...
Gartner told Reuters that it overestimated how many PCs Acer shipped in the last seven quarters by a...
Singed by user reaction to its plans to up the price of its support contracts, SAP Tuesday postponed...
Apparently Google Gears ain’t gonna stick around that long. Google Apps will eventually get their of...
Gartner thinks the server business has stopped sliding into the abyss. Third-quarter sales weren’t a...
Office Web Apps, Microsoft’s answer to Google Apps, are supposed to be out sometime in June along wi...
Gartner is buying ~$40 million-a-year AMR Research Inc for close to $64 million in cash. AMD special...
Oracle seems to have divided the open source ranks over the MySQL delay it’s having closing its acqu...
The Korean government is going to sink around $172 million into cloud computing next year under a st...
We hear – well, you know how people talk – that Oracle has been quietly meeting with the European Co...
In response to Opera’s complaints Microsoft has reportedly modified the proposed ballot screen that’...
CA is looking for talent in EMEA: associate account managers, directors of solution sales, senior so...
Microsoft has sold the Folio and NXT businesses it got when it bought Fast Search and Transfer, the ...