AD

Web applications on the database concurrency of a solution (Reprinted)

I say it first processes, such as modifying a record:
When the user point of modified, read data from the database and display the Edit menu, and then edit the data, and then determine the save point to the database. If more than one user, when the A point changes the user to save the data in this time period,, B users can not modify, that this does not seem to do it with the transaction,,, we give a solution, but I think I have a point of conflict . When this time period the user can modify, so the data for the A user has a consistent, A is B the user to see the data before the user does not modify, if not modified, not the reality, if the user points the modified B not point to determine, and then the user out for emergencies or WC,, then A user is not waiting,,,
Buy tickets online often cite the example of people buying tickets when the conductor after hearing A check found that 2,, buy a ticket just to two people, in the query and sold this time, if no other windows sell, if not realistic, and sometimes this time is very long, and, a minute or so it, other windows can not sell more than 10 windows of this vehicle trips is not very deadly, and almost every window will account for a Train query, the query to determine if the price of the sale of this paragraph other windows can be sold, and also has some problems, conductor A check found that left two, and tell the ticket man, just two left, this time Customer sure you want to, if at this time, the other window to sell one, it will be in determining when to sell to fail, could keep up tickets to explain. ,, This issue has trapped my other long time,, thank you for giving me a solution, maybe I was wrong, and, online, etc.

LZ actual case seems to have not done ah, now I give you to disclose the actual ticketing system under a program example:

First, the lock is not so complicated, the actual application will try to avoid conflict from a business point of view:

Actual ticketing system like this:

1. Ticket, the "seat number" is to compete for resources;
2. Tickets, view ticket number is the lock does not occur.
3. Ticket, there is a ballot (election seat number) of the action, select seat number determined only when the number lock occurs (that is locked to change as the number, even if the lock number, only modify the tag, said he was temporarily locked) ;
4. Other customers Pay the bill and submit the transaction to determine, at this time, it became selling the tickets (of course, is locked in number, to modify the corresponding tags sold, and other process operations).

From this process perspective, there is almost no conflict of so many (only choice of numbers, there may have been someone else chose, which should know, can be another choice of numbers), this is the program.

7th floor xjlqlqlq reference response:
LZ actual case seems to have not done ah, now I give you to disclose the actual ticketing system under a program example:

First, the lock is not so complicated, the actual application will try to avoid conflict from a business point of view:

Actual ticketing system like this:

1. Ticket, the "seat number" is to compete for resources;
2. Tickets, view ticket number is the lock does not occur.
3. Ticket, there is a ballot (election seat number) of the action, select seat number determined only when the number lock occurs (that is locked to change as the number, even if the lock number, only modify the tag, said he was temporarily locked) ;
4. And so on ...


The key is the third step. I understand though, when buying tickets outside the percussion is just a buy button moves, but the background should be divided into one, lock the current record, 2, lock modify the ticket property after the success of the two movements. Only the first successful action in order to make the second action.
I tend to not use the SQL statement to lock a line, but the bank has a field, modify the success of the said lock. Impact on the performance of the lock table.

I also think it is the third step, but I details I disagreed, I believe that the ballot paper, lock the record (do not have to use locks, you can add a field lock, then lock it into ,) when the transaction is complete customer Jiaoqian submitted, and then sold the record to change the state, when the cancellation of the deal, the, then locked into non-locked state, I do not know understand that to not

"If you do not lock to lock the field to change, seem to have problems, when to modify the lock field is locked, at this time if the machine has restarted, it was not always locked,"

Right, since it is two-phase commit, accidents may occur naturally in the middle of the process,

Way, as you say crash, and this needs to be resolved, of course, in practice the thoughtful, there is another solution.
So, this is a project, there are series of problems to solve.

If it crashes, you can have programs to address (this can be their own considerations, the company may have different strategies), the simplest way is, the client has cached log records, if the crash, start time, will naturally know the last unfinished business; Of course, if there is a good program can be resolved in the background. In short this means to many.

Reprinted: **topic.csdn**/u/20090520/10/d2eac176-afca-4321-9384-45d82a6f010b.html?68881
标签: long time, web applications, paragraph, point of view, business point, train, database concurrency, time period, emergencies, ticketing system, time customer, point of conflict, ticket man, vehicle trips, buy a ticket, conductor
分类: Database
时间: 2010-06-11

相关文章

  1. Highly scalable Web applications HTTP Session Sharing Scheme

    In building the level of flexibility for expansion, high availability when Java Web applications, on the http ...
  2. WebSphere packaged web applications and deployment options

    WebSphere packaged web applications and deployment scenarios, the original quote from: http://www.hashei.me/20 ...
  3. weblogic8.15 under linux as well as web applications to install and configure the jdbc

    System Environment: linux weblogic8.15 jdk1.4.2 mysql jdbc driver 1. Install weblogic 1.1 modified to run the ...
  4. Indexed DB: the future cornerstone of all Web applications

    Original Source: http://soft.chinabyte.com/database/270/11200270.shtml What is the future of the Web applicati ...
  5. [Translation] class Web applications to achieve the flexibility of RESTful Core - Part 4 - Model (below)

    Original: A RESTful Core for Web-like Application Flexibility - Part 4 - Patterns Of: Randy Kahle and Tom Hick ...
  6. Web container and Web applications introduced

    http://hi.baidu.com/westsky/blog/item/154c871ed87f69194034171e.html Web container and Web applications introdu ...
  7. Session mechanism for web applications

    Session mechanism for web applications directory: 1, the term session Second, HTTP protocol and the state to m ...
  8. Jasperreport + ireport practice operations and web applications

    Jasperreport + ireport practice operations and web applications To learn End jasperreports + ireport, for I fe ...
  9. Simple Solution for Complex Java Web Applications: Connection Pools and JDBC

    Practically every request from a user's JSP / servlet creates a new database connection, which takes time and ...
  10. Distribution of Web site storage of database

    [Introduction] Sites in the Web 2.0 era, often face rapidly increasing traffic (which is a good thing), but ou ...
  11. How to develop Web applications

    This is a frequently asked question, asked for granted. As a programmer, why do I have to be considered to kno ...
  12. Building Semantic Web Applications - build Semantic Web applications

    wiki Address: http://protegewiki.stanford.edu/wiki/BuildingSemanticWebApplications Main article: ProtegeOWL_AP ...
  13. SD2C: CSDN Product Director Fankai - Building High Performance Web Applications with Rails

    SD 2010, the General Assembly over two weeks, the official said that out of PPT, but not to download (to promp ...
  14. Web applications using ETags reduce bandwidth and load

    (Reprinted Cool ground network) Of: Gavin Terrill Song Wei from the translator: InfoQ ground network to collec ...
  15. Large, high concurrent high-load web applications architecture - cache architecture strategy

    The structure of the current composition of the site to cache commonly used to provide the performance of WEB ...
  16. Building Semantic Web Applications - build a Semantic Web application

    wiki Address: http://protegewiki.stanford.edu/wiki/BuildingSemanticWebApplications Main article: ProtegeOWL_AP ...
  17. About DB2 database concurrency (1)

    About DB2 database concurrency of (turn) Description: OLTP database is usually high concurrent usage pattern, ...
  18. About DB2 database concurrency (3)

    Optimistic locking and pessimistic locking is the corresponding, so to talk about optimistic locking, it is in ...
  19. Case study database concurrency consistency

    Reproduced @ http://www.cnblogs.com/zhenyulu/articles/633486.html Case study database concurrency consistency ...