T
the Rat
All,
I have recently began experimenting with CMP 2.0 Entity Beans and have
run into a question. I have a server application that provides
resources to numerous client applications. Because this server
application needs to scale, we are looking at clustering application
servers on multiple machines. From everything that I've read so far,
it sounds as if local entity beans are the way to go for performance
reasons - but that they will not function properly in a clustered
environment. Is this true? If my server app on machine #1 reads the
AccountBean #17 from the database and my server app on machine #2 reads
the AccountBean #17 and they are both local entity beans (representing
the same row in the same table of the db) then I will have two separate
local CMP entity beans (one per machine), correct? If this is the
case, how will the beans "know" about each other?
Imagine the following scenario:
1. husband goes to ATM to check account balance - sees he has $500 in
account.
2. wife goes to different ATM to check the SAME account balance - sees
there is $500 in account.
3. the husband, seeing that there was $500 in the account withdrawals
the $500.
4. the wife, seeing that there had been $500 in the account, attempts
to withdrawal $500 from the same account and is given a hefty
insufficient funds penalty.
The above is a basic problem caused by a "dirty" read. If I am using
local entity beans for the accounts, how is this problem prevented?
The only solution I can see is for the entity beans to actually place
locks on the rows/tables - so that the wife can't see how much money is
in the account until her husband is through updating it.
I've been unable to find a clear answer on this anywhere - the
information that is available on how clustering impacts entity beans is
confusing - at the least the info that I've seen.
Any light you can shed would be appreciated.
-john
I have recently began experimenting with CMP 2.0 Entity Beans and have
run into a question. I have a server application that provides
resources to numerous client applications. Because this server
application needs to scale, we are looking at clustering application
servers on multiple machines. From everything that I've read so far,
it sounds as if local entity beans are the way to go for performance
reasons - but that they will not function properly in a clustered
environment. Is this true? If my server app on machine #1 reads the
AccountBean #17 from the database and my server app on machine #2 reads
the AccountBean #17 and they are both local entity beans (representing
the same row in the same table of the db) then I will have two separate
local CMP entity beans (one per machine), correct? If this is the
case, how will the beans "know" about each other?
Imagine the following scenario:
1. husband goes to ATM to check account balance - sees he has $500 in
account.
2. wife goes to different ATM to check the SAME account balance - sees
there is $500 in account.
3. the husband, seeing that there was $500 in the account withdrawals
the $500.
4. the wife, seeing that there had been $500 in the account, attempts
to withdrawal $500 from the same account and is given a hefty
insufficient funds penalty.
The above is a basic problem caused by a "dirty" read. If I am using
local entity beans for the accounts, how is this problem prevented?
The only solution I can see is for the entity beans to actually place
locks on the rows/tables - so that the wife can't see how much money is
in the account until her husband is through updating it.
I've been unable to find a clear answer on this anywhere - the
information that is available on how clustering impacts entity beans is
confusing - at the least the info that I've seen.
Any light you can shed would be appreciated.
-john