aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate on Multiple Servers. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate on Multiple Servers." Watch "Hibernate on Multiple Servers." New topic
Author

Hibernate on Multiple Servers.

Julio Compadre
Greenhorn

Joined: Sep 14, 2007
Posts: 10
Hi,

I have a question that is puzzling me for a while ...

I have a simple Struts app that is not very complex, only 8 forms. I used for the view layer several JSP's with displaytag(not very "strutish" I know ), normal Struts tags and all sorts of necessary input handling struts tag facilities.
I used Struts for the control layer and Hibernate as the ORM technology.
All relatively simple.
My app main purpose is to optimize wharehouse logistics and I apply a number of different algorithms to do so depending on the customer request and needs.
Apart from this I also have a small part of the code (2 actions) ready to interface a legacy system in order to access the customer old database and ERP software.

My question is this one:
Now my application will grow and one of the requirement is that I _must_ have multiple servers running the same application and accessing my current server DB and his local MySQL DB from many locations in the world.

That is, one central DB server and multiple server with the same app on several location in the world.

My question is this: what are the problems anyone has experienced running on the same database multiple instances of the same application with Hibernate ?
The database access and configuration is simple, I could use a ssh tunnel for example and all hibernate configs on the distributed servers would work as if it was a local database(on 127.0.0.1).

My concern however if over the integrity of the application since it runs with multiple independent hibernate instances.

Can I use my app with no modifications, that is direct hibernate sessions on different servers.
Or should I make a different DB access for example through RMI making use on Only one Hibernate app running on the same server.

In my view has the pertinent tables all are transaction enabled there is no problem from the standpoint of the data integrity in the DB.
The problem can be multiple independent sessions of Hibernate running on different servers.

I am wrong on this one?
The issue is really either make zero modifications, a small rmi call mechanism and minor changes or use an EJB component to make the thing work "proper" .

Someone with experience on this could let me know what I am facing ...

Thanks in advance.
Regards


Java Rules!!!
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The presence of Hibernate doesn't change the basic behaviour of a database application being accessed by multiple clients. Writing some sort of proxy server for your database is overkill. Assuming you are being cautious with caching and using optimistic locking everything should be OK.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Julio Compadre
Greenhorn

Joined: Sep 14, 2007
Posts: 10
Hi,

Yup, my opinion too ... I foresee no problem with the optimistic locking and transactions on the DB ... this particular application is not very intensive in terms of data access, although the algorithms and calculations are very complex, data access is I would say fairly slow. Also I did not even measure DB access time during the application stress tests ... (do not really know how to do that also, had to figure it out) ... because simply once a user loads all pertinent data for each operation the app takes a Long time to make all calculations ... and I mean a long time (up to 3 minutes sometimes) ... The resulting data from the calculations is then stored in the DB and files but at that stage there is not problem whatsoever.

The issue really is about caching ... I quite frankly am thinking about some radical move like not using caching at all.

Paul Sturrock wrote:The presence of Hibernate doesn't change the basic behaviour of a database application being accessed by multiple clients. Writing some sort of proxy server for your database is overkill. Assuming you are being cautious with caching and using optimistic locking everything should be OK.


Caching is the problem, I can not guarantee what happens on the several servers, if users access the same data for example. On this app the idea of having multiple servers is to distribute the calculation load but the data model must be unique in order to optimize logistics. That's the all point about the new development.
Also the risk increases as com links go down all the time so I have no guarantee of actual DB access all the time ...

The more I think about it the more I feel I have to reduce caching to zero if possible!
I am being too paranoid on this ?


Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate on Multiple Servers.
 
Similar Threads
B&S - Record handling
muliple db's accessed by 1 application server
Hibernate in a multi-server architecture
Question for the experts!
Singleton Pattern