and capability of the people PROCESS. Assessing the maturity of the processes PRODUCT. Assessing the Architecture & Design of the product Google Devfest 04
about consistency? What are the tools for performance? • Scale up • Scale out • NLBs • SLBs What are the tools for consistency? • ORMs handle this pretty well. • Databases handle this for us. • Docker Swarm • GKE • Service Fabric…. Google Devfest 010
payment both exist, or both do not exist. Else it is an inconsistent state. Order: No Order: Yes Order: No Order: Yes Payment: No Payment: Yes Payment: Yes Payment: No Consistent Consistent Inconsistent Inconsistent Google Devfest 012
will be reserved exclusively for the transaction (INSERT, UPDATE, DELETE). One lock on a page or row. Shared Lock (S) Reserve page or Row for read Operation only. Multiple locks on a page or row by different transactions. Update Lock (U) Similar to (X). Adds an additional lock (U on the row that is in (S). Once data is ready for update, this lock changes from (U) to (X). Intent Lock (I) Intention to acquire lock in hierarchy objects. At Table Level and increases performance as there is no need to do operation on row level. Escalates to (X) or (S) depending upon the transaction. LOCKS Google Devfest 016
wait as an UPDATE is changing the data ISOLATION LEVELS Read Uncommitted Don’ t wait. Read the Dirty Data i.e. data that is changed but not committed yet. Read Committed With Snapshot Don’t wait. Take the snapshot at the start of the transaction. Read the snapshot Data i.e. the data that may be changed by another transaction in progress Repeatable Read UPDATE, please wait as my SELECT is reading the data Serializable Read Read Committed + Repeatable Read All wait until transaction is done. Big Performance issue Google Devfest 017
Changing within same transaction Use Repeatable Read or Read Committed in Queries to get accurate data. Queries might be slow. Transaction is Hanged Check Commit and Rollback in your transactions. Check for any open transaction in the database. Keep Transactions small. Deadlocks Keep Transactions small. Always log Deadlocks and check deadlock Graph / XML to find the issue. Use Read Uncommitted in reporting queries if possible. Try using resources in the same order. Retry on deadlock exceptions. Google Devfest 018