Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
When you want to make your application Clusterable,
you have to first identify what are thing
(which holds the State data)should be synchronized among all the
Machines in the Cluster for
supporting High avialblity
Without impacting the application functionality.
Here
are the list of things you should look at.
HTTP Session (Session Replication)
:
In
a Clustered ENV, your application server keep the HttpSession
state in Sync among all
the Servers in
Cluster, this could be by using different communication
technique
like IP MultiCast etc. So for
better performance you have to do the following.
i) Try to keep little data in HttpSession, do not keep pretty big
Object graphs in
HttpSession, becase
each change to Session Data would triggers session
replication
which serializes the
Session state and transport that to all the Servers in
cluster.
ii) All the
Objects stored in Session should be Seriazable , if not
Session
replication would
be failed.
Stateful session beans :
You should take the same considetaions as
above, even in StateFul Session Beans case.
Singleton classes :
By design as Singleton
classes would be maintained as One Instance per JVM, so
making
a Singleton class Custable is a little
Chanllenging as all the JVMs in any given Clusttered
ENV would have their own Instance of Singleton
classes. So you have to manually keep
the One possible solution for this issue is
below.
i) Serialize the First Instance
of a singleton class and store in Database. Serialize the
First Instance of a singleton class
which is created on any JVM and store that in Database,
let all other JVMs check in Database if a singleton
class was already created before
Creating
their own Instance, this way we can make sure that the same
Instance is being used
by all the
Servers.
JMS
Queues:
You may need to use Distributed Queues
or Topics.
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.