to a database deployment strategy. For constraints to beapplied, the tables must reside on a single database server,precluding horizontal scaling as transaction rates grow. Inmany cases, the easiest scale-out opportunity is movingunctional groups o data onto discrete database servers.Schemas that can scale to very high transactionvolumes will place unctionally distinct data on dierentdatabase servers. This requires moving data constraintsout o the database and into the application. This alsointroduces several challenges that are addressed later inthis article.
Eric Brewer, a proessor at the University o Caliornia,Berkeley, and coounder and chie scientist at Inktomi,made the conjecture that Web services cannot ensure allthree o the ollowing properties at once (signied by theacronym CAP):
. The client perceives that a set o operationshas occurred all at once.
. Every operation must terminate in anintended response.
. Operations will complete, even i individual components are unavailable.Specically, a Web application can support, at most,only two o these properties with any database design.Obviously, any horizontal scaling strategy is based ondata partitioning; thereore, designers are orced to decidebetween consistency and availability.
ACID database transactions greatly simpliy the job o theapplication developer. As signied by the acronym, ACIDtransactions provide the ollowing guarantees:
. All o the operations in the transaction willcomplete, or none will.
. The database will be in a consistent statewhen the transaction begins and ends.
. The transaction will behave as i it is the onlyoperation being perormed upon the database.
. Upon completion o the transaction, theoperation will not be reversed.Database vendors long ago recognized the need orpartitioning databases and introduced a technique knownas 2PC (two-phase commit) or providing ACID guaran-tees across multiple database instances. The protocol isbroken into two phases:
• First, the transaction coordinator asks each database
involved to precommit the operation and indicatewhether commit is possible. I all databases agree thecommit can proceed, then phase 2 begins.
• The transaction coordinator asks each database to com
-mit the data.I any database vetoes the commit, then all databasesare asked to roll back their portions o the transaction.
s h a r d i n g