java - database sharing between two servers -


My current set is a dedicated server with Java, the Hibernate app running on TotalCat, Apache HTTP Server, MYSQL.

I need to get another server to share the load, but first using the same database on the server

Backend processing (excluding DB transactions) is time consuming, Therefore second server for backend processing).

Will this setup have any unwanted results? Is this optimal setup?

My apps have been updated / deleted and there is transaction control like this:

 beginTransaction (); . Save GetSession () (obj); //sessionFactory.openSession().save(obj); As long as you update the database on a shared table, only one of the apps is OK. You definitely do not want to: 

  App1: Delete / update table 1. Records 24Ap2: Delete / Update Table 1 Records 24  

Because when hibernation writes a record one of the procedures will notice the data has changed and throwing an error and replacing it as a classic Hysenbagh is really difficult to reproduce is. On the other hand, responsibilities are clearly separated (apps read data to read, but it should not be deleted / updated on the same table). Despite the upgrade in the future, he can not take into account the behavioral document.

Edit 1: Reply to comments

For any table:

  • Both apps can be inserted
  • Both apps can be selected
  • One of these apps can also be updated / removed in that table

Your frontend is likely to be a table , And the backend can read those tables, update the rows where necessary, the new result can create rows, and the pig The Nnirpekshta can delete rows.

Alternatively, when apps communicate, the frontend business can transfer back ownership of records to the given backpack, which gives ownership back to the end. Ensure that the cache has been flown in hibernation (the transaction has been executed) and before the transfer of ownership, there is no hibernation of that work.

The game's move is to ensure that hibernate will not attempt to write records which can be replaced by another app because it will cause stellestate expansion.

And how do I solve a similar problem: <1 p>

  • Receives data on AP1, and writes it in Table 1
  • reads app2 table 1 , Processes it, and writes / updates 2 tables
  • Ap2 deletes processed records in Table 1
  • Note that App 1 only has a shared table Writes it reads, writes and updates from other tables, but those tables are not accessed by AP2, this is There is no problem for.


    Comments

    Popular posts from this blog

    c# - How to capture HTTP packet with SharpPcap -

    php - Multiple Select with Explode: only returns the word "Array" -

    php - jQuery AJAX Post not working -