2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
I received an email stating that AOL finally aband...
TOP THREE LINKS YOU MUST CLICK ON
Scalability of J2EE Applications: Effective Caching's Key
Sooner or later all architects and developers of large-scale J2EE products face the same problem: their software's response time gets slower and slower, and the scalability of their solution is ending. This article investigates caching solutions that promise to help; sheds some light on their limitations; and describes an easy, lightweight, and effective caching mechanism that solves most of the issues.
Reader Feedback: Page 1 of 1

Hi Jamal, cluster-wide means than any cluster node can request a lock, optionally queue for it (if it''s taken), and thus have the ability to safely work with data in-memory in the cluster, just like having "synchronized" as a keyword allows you to write thread-safe Java code. So just as "synchronized" is a necessary ingredient of scaling to multiple threads, the ability to manage locks and coherent data in a cluster is a necessary ingredient of horizontal scaling in a cluster.

Perhaps I am misinterpreting the meaning of the ?cluster-wide? lock. It would seem that if you were locking a cache at the record level for a read/write operation, as the case may be, that the overall performance would degrade as the number of nodes increases because each node would effectively be locked until another node finished it?s work. This in turn creates a virtual cluster wide transaction (- ick -). A transaction of this nature can only decrease in performance as more nodes are added to the cluster.

Cluster wide locks sound like a really, really bad idea for large-scale systems where scalability is key.

Hi Jamal,

The in-cluster operations generally start off more performant because they occur in-memory (and in Java) in the cluster in which the application is running, and do not have to go through inefficiencies of translating through the JDBC API. The icing on the cake is that the cluster performance does not degrade as more and more machines enter the cluster while the database performace decreases in the same situation. The operation stays at a relatively constant speed, regardless of of whether you have 2 servers or 20 servers in the cluster. Yet, with 20 servers you can manage 10x the throughput (as 2 servers).

Rob, you indicate that Coherence provides cluster-wide locking as the concurrency mechanism. Can you please explain how a cluster-wide lock ?increases? performance?

"For the data that are modified frequently and concurrently, they are best not to be cached."

Actually, that is the area where you will see the largest performance improvement by caching. Coherence is used in this exact scenario since it provides cluster-wide locking as the concurrency mechanism.

That coupled with the use of our "read-through/write-behind" technology when using an underlying datastore increases performance further. The huge advantage of a read-through/write-behind cache in a cluster is that the database is almost completely unloaded of repetitive read operations, and more importantly the database is unloaded from repetitive writes, which are usually much more expensive than read operations. Combined with the HA features of Coherence, even the write-behind data is managed safely during failover, allowing an application server to unexpectedly fail without any loss of uncommitted (write-behind) data.

The more important thing is to determine what to cache and how much to cache. All applications use some kind of reference data that are used application-wide and change very infrequently. These can be cached at global level, at web/business tier using either singleton or application context. They can be refreshed overnightly and/or on demand. We have successfully implemented this type of cache in a number of projects, with custom notification mechanism to synchronize the caches on clustered servers.

The Session object has also a place to cache certain types of data, such as those that are applicable mainly to the user session, hardly shared with other users, infrequently modified (rarely modified by other users while the user session is active). However we shall not store too many objects in the Session or the application will not scale.

For the data that are modified frequently and concurrently, they are best not to be cached.

I agree with Stefan that Entity EJB is not a good place to implement caches.

Your article is interesting but if scalability is your main aim (as the first paragraphs imply) then a thorough discussion of how to design out server maintained state information can be more important than sophisticated caching. Rather than recommending the use of Entity beans, designing a system that eliminates (or minimizes) their need (since they are, by definition, server managed state) will go much further toward a truly "linearly scalable" distributed system.

Regards,
Jim

Hi John, those limitations do not apply to system libraries, such as JDBC drivers, which *must* open sockets in order to communicate with a database running in a different process or on a different machine.

The rules for EJBs, particularly the limitations, are there to restrict the component developer (someone writing an EJB that may be deployed to any application server) so that they are assured of the highest level of portability. The spec now explains a lot of the limitations. For example, if you access the file system, and the application server is clustered, how can you be sure that the file will be there when you fail over (since it might be a local file system, or the machine that is failed over to could be running on a completely different site!)

Similarly, managing threads and sockets may be disabled for the EJB components from a security perspective, to allow for controlled environments for third party hosting of applications.

IBM is working to standardize APIs so that the container can expose things like thread pooling to the component developer. In the mean time, those things should be considered off limits to an EJB developer if you want to make your EJBs as portable as possible. However, system libraries are still able to (and often must) use those APIs to implement features like database connectivity.

Peace.

It strikes me that there''s little difference between an EJB Bean class calling a prohibited API and the Bean class calling an intermediate class which calls the prohibited API.

Does EJB make a provision for when there is no alternative but to call these APIs? e.g. You can call them, as long as the call is routed through an XXX? (eg resource adapter? don''t really know much about resource adapters, apologies if this is a meaningless suggestion). How is a JDBC driver supposed to access a remote DB without making socket calls?

Cheers,

J

A system library, such as Coherence or a JDBC driver or a JMS implementation, is allowed to manage socket communication, while an EJB component is not. Optionally, you can use Coherence as a transactional resource through the J2CA (Java 2 Enterprise Edition Connector Architecture) API.

As far as compatibility, Coherence has hundreds of production deployments on numerous application server platforms (including WebSphere 3.5.4 - 5.1 and WebLogic 4.5.1 - 8.1) on JDK 1.2 - 1.4.

Peace.

Hi Cameron, thanks for the replies.

To my reading, the EJB 2.0 spec (section 24.1.2 to be precise!) appears to prohibit the use of multicast sockets: "An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast."

I''m genuinely not trying to be argumentative here, just trying to work out whether or not Coherence does or doesn''t contravene the spec, and if it does, was it done intentionally (in which case, what was the reason)?

Normally, I''d expect an intentional contravention of a spec to be accompanied by an explanation (so customers can make up their own minds whether or not they think it may cause them problems). I''d like to give Coherence (and several other caching products) the benefit of the doubt, but at present that would be based on faith rather than evidence!

Tangosol Coherence is built on top of a peer-to-peer cluster and uses the TCMP protocol, which is an asynchronous, dynamically-switched unicast/multicast datagram protocol, with reliable in-order delivery of cluster messages. Unlike simple invalidation strategies, Coherence maintains a coherent image of the data across the cluster, and supports fully replicated caches, cluster-partitioned caches, near caches, overflow (to NIO buffers and/or disk) caches, and database-backed caches.

What does it use for propagating cache messages in clusters - JMS, sockets? If sockets, does it do blocking reads?

Tangosol Coherence is supported on basically all Java / J2EE application servers, and doesn''t screw with anything like setMessageListener(). It''s also the most mature and widely deployed clustered caching solution in the market.

I recently investigated several open source and commercial caching products and hit somewhat of a brick wall with the J2EE & EJB specs.

I needed a cache to serve read-mostly data in a clustered EJB application. The application runs on several app servers, so portability was a key requirement.

In my experience, the key element in ensuring portability is standards compliance. The J2EE and EJB specs forbid EJBs from using certain APIs, namely those that create threads, block on socket operations, etc. They go even further by explicitly naming forbidden APIs, such as JMS''s setMessageListener().

However, pretty much all the caching products I investigated were using these APIs.

In one example, I queried the vendor (who shall remain nameless!) about the use of setMessageListener() in their product. They replied by stating that (a) it works and (b) it was fine to use those APIs in classes that the EJB *uses*, just not in the *actual* EJB bean class itself.

My feeling on (a) was that, if it contravenes the spec, then working on AppServer version X doesn''t guarantee it will work on version X+1. It also doesn''t mean it will work on any other app server. On (b) I don''t see that it makes any difference whether the call is in class A or in class B which gets called from A (in the same thread)?!... The vendor in question had only recently started marketing their product as a J2EE cache (previously it had been best known as a servlet cache). I don''t know if those restrictions apply to the web tier.

In the end, due to portability concerns, we decided to roll our own. Our invalidation strategy was simple and was achievable using JMS and MDB''s (no spec contravention required).

I''d be interested in other people''s experiences and perspectives on this topic.


FEATURED WHITE PAPERS
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS

SYS-CON FEATURED WHITEPAPERS

Unit testing is hard. There I said it. Although I have been developing software for the past 18 year...
Continuent has announced support and enhancements to MySQL Server 5.1.30 GA release, the 5.1 product...
As a software journalist, there are times when certain vendors will shut the door on reporting oppor...
Active Endpoints has announced the general availability of ActiveVOS 6.0.2, in response to ever incr...
Just because the web has been open so far doesn't mean that it will stay that way. Flash and Silverl...
Doing network I/O on the user interface (UI) thread is bad. Most developers know that and can tell y...
Over the course of the past few decades, the consumer media industry has evolved from a slow-moving ...
The open source community includes many early advocates of the recent wave of emerging SOA-related t...
JavaScript is pretty much everywhere you look these days, reaching far beyond your desktop browser. ...
Transmeta, the uppity microprocessor wannabe that pushed Intel to create low-power chips before Inte...
The Java Community Process (JCP) Program Management Office has announced the final results of the 20...
If you think your network is safe from the new strains of content security threats, think again. Tod...
Tidal Software has announced Intersperse 8.0, a product that monitors J2EE and .NET applications and...
ILOG has announced ILOG JViews 8.5, the latest version of ILOG’s Java-based visualization suite, w...
Emulex has announced that it will offer Fibre Channel Host Bus Adapters (HBA) and Fibre Channel over...
The BlackBerryR Technical Webcast Series is designed to help BlackBerry administrators better manage...
The BlackBerry Technical Seminar is back this fall with breakthrough new sessions you won’t want t...
In an effort to head off its disappearance below the horizon, Sun is going to lay off 5,000-6,000 pe...
Working across all of Sun, Senior Vice President, Dave Douglas, has been appointed today to lead the...
In 45 jam-packed minutes that will include case studies and live technology demonstrations, the VP o...
SPONSORED BY INFRAGISTICS
In every field of design one of the first things students do is learn from the work of others. They ...
There are many forces that influence technological evolution. After a decade of building enterprise ...
2008 is going to be an important year for Rich Internet Applications. Most organizations are deliver...
The OpenAjax Alliance is developing an Ajax industry wishlist for future browsers, using a dedicated...
Infragistics announced the availability of two Community Technology Preview (CTP) User Interface (UI...
The YUI development team has released version 2.5.2; you can download the new release from SourceFor...
ADS BY GOOGLE