Prev | Current Page 142 | Next

Brad Ediger

"Advanced Rails"

Thus, you can throw five of them behind a load
balancer and it doesn??™t matter if a user is served by different servers throughout the
course of a session. However, the bottleneck is the database. A big assumption of
this shared-nothing architecture is that the application servers all share a database. If
you use a database that doesn??™t have great support for concurrency, you will have
problems.
Old versions of MySQL had some fairly serious issues, many revolving around the
issue of data integrity and constraints. The problem was not so much that the issues
existed as that MySQL??™s developers seemed to have an attitude of ???you aren??™t going
Multiversion Concurrency Control
Multiversion concurrency control (MVCC) is one of the most powerful ways to achieve
isolation between concurrent database transactions. MVCC gives each transaction a
snapshot of the data it accesses, as the data existed at the start of the transaction. The
transaction performs actions on the data, which are logged with timestamps. When the
transaction commits, the DBMS checks the logs to ensure there are no conflicts with
other transactions; if the transaction can be performed successfully, it is applied to the
database at once, atomically.
The alternative to MVCC is row-level locking, which is used by MySQL??™s InnoDB storage
engine. Row-level locking locks only those rows affected by an update during a
transaction (as opposed to page- or table-level locking, which are more coarse).


Pages:
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154