[go: nahoru, domu]

Editing Optimistic concurrency control

You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits.
Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.
Latest revision Your text
Line 2: Line 2:
'''Optimistic concurrency control''' ('''OCC'''), also known as '''optimistic locking''', is a [[Non-lock concurrency control|non-locking concurrency control]] method applied to transactional systems such as [[relational database management systems]] and [[software transactional memory]]. OCC assumes that multiple transactions can frequently complete without interfering with each other. While running, transactions use data resources without acquiring locks on those resources. Before committing, each transaction verifies that no other transaction has modified the data it has read. If the check reveals conflicting modifications, the committing transaction rolls back and can be restarted.<ref>{{cite book | title = Expert One-on-One J2EE Design and Development | first = Rohit | last = Johnson | publisher = Wrox Press | year = 2003 | isbn = 978-0-7645-4385-2 | chapter = Common Data Access Issues | chapter-url = http://learning.infocollections.com/ebook%202/Computer/Programming/Java/Expert_One-on-One_J2EE_Design_and_Development/6266final/LiB0080.html | archive-url = https://web.archive.org/web/20111008203709/http://learning.infocollections.com/ebook%202/Computer/Programming/Java/Expert_One-on-One_J2EE_Design_and_Development/6266final/LiB0080.html | archive-date = 8 October 2011}}</ref> Optimistic concurrency control was first proposed in 1979 by [[H. T. Kung]] and John T. Robinson.<ref name="KungRobinson1981">{{Cite news| title = On Optimistic Methods for Concurrency Control | first = J. T. Robinson | last = H. T. Kung | publisher = ACM Transactions on Database Systems | year = 1981 | url = https://apps.dtic.mil/dtic/tr/fulltext/u2/a081452.pdf| archive-url = https://web.archive.org/web/20190831230313/https://apps.dtic.mil/dtic/tr/fulltext/u2/a081452.pdf| url-status = live| archive-date = August 31, 2019}}</ref>
'''Optimistic concurrency control''' ('''OCC'''), also known as '''optimistic locking''', is a [[Non-lock concurrency control|non-locking concurrency control]] method applied to transactional systems such as [[relational database management systems]] and [[software transactional memory]]. OCC assumes that multiple transactions can frequently complete without interfering with each other. While running, transactions use data resources without acquiring locks on those resources. Before committing, each transaction verifies that no other transaction has modified the data it has read. If the check reveals conflicting modifications, the committing transaction rolls back and can be restarted.<ref>{{cite book | title = Expert One-on-One J2EE Design and Development | first = Rohit | last = Johnson | publisher = Wrox Press | year = 2003 | isbn = 978-0-7645-4385-2 | chapter = Common Data Access Issues | chapter-url = http://learning.infocollections.com/ebook%202/Computer/Programming/Java/Expert_One-on-One_J2EE_Design_and_Development/6266final/LiB0080.html | archive-url = https://web.archive.org/web/20111008203709/http://learning.infocollections.com/ebook%202/Computer/Programming/Java/Expert_One-on-One_J2EE_Design_and_Development/6266final/LiB0080.html | archive-date = 8 October 2011}}</ref> Optimistic concurrency control was first proposed in 1979 by [[H. T. Kung]] and John T. Robinson.<ref name="KungRobinson1981">{{Cite news| title = On Optimistic Methods for Concurrency Control | first = J. T. Robinson | last = H. T. Kung | publisher = ACM Transactions on Database Systems | year = 1981 | url = https://apps.dtic.mil/dtic/tr/fulltext/u2/a081452.pdf| archive-url = https://web.archive.org/web/20190831230313/https://apps.dtic.mil/dtic/tr/fulltext/u2/a081452.pdf| url-status = live| archive-date = August 31, 2019}}</ref>


OCC is generally used in environments with low [[Block contention|data contention]]. When conflicts are rare, transactions can complete without the expense of managing locks and without having transactions wait for other transactions' locks to clear, leading to higher throughput than other concurrency control methods. However, if contention for data resources is frequent, the cost of repeatedly restarting transactions hurts performance significantly, in which case other [[concurrency control]] methods may be better suited. However, locking-based ("pessimistic") methods also can deliver poor performance because locking can drastically limit effective concurrency even when deadlocks are avoided.
OCC is generally used in environments with low [[Block contention|data contention]]. When conflicts are rare, transactions can complete without the expense of managing locks and without having transactions wait for other transactions' locks to clear, leading to higher throughput than other concurrency control methods. However, if contention for data resources is frequent, the cost of repeatedly restarting transactions hurts performance significantly, in which case other [[concurrency control]] methods may be better suited. However, locking-based ("pessimistic") methods also can deliver poor performance because locking can drastically limit effective concurrency even when deadlocks are avoided.


== Phases of optimistic concurrency control ==
== Phases of optimistic concurrency control ==
Line 34: Line 34:
* Most implementations of [[software transactional memory]] use OCC.{{citation needed|reason=Claim initially said optimistic locking, now says OCC, both claims unsourced|date=March 2019}}
* Most implementations of [[software transactional memory]] use OCC.{{citation needed|reason=Claim initially said optimistic locking, now says OCC, both claims unsourced|date=March 2019}}
* [[Redis]] provides OCC through WATCH command.<ref>{{cite web | url = http://redis.io/topics/transactions | title = Transactions in Redis }}</ref>
* [[Redis]] provides OCC through WATCH command.<ref>{{cite web | url = http://redis.io/topics/transactions | title = Transactions in Redis }}</ref>
* [[Firebird (database server)|Firebird]] uses [[Multiversion concurrency control|Multi-generational architecture]] as an implementation of OCC for data management.{{citation needed|date = November 2020}}
* [[Firebird (database server)|Firebird]] uses [[Multiversion concurrency control|Multi-generational architecture]] as an implementation of OCC for data management.{{cn|date = November 2020}}
* [[Amazon DynamoDB|DynamoDB]] uses conditional update as an implementation of OCC.<ref>{{cite web | url = https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ConditionalUpdate| title = Working with Items and Attributes - Conditional Writes| access-date = 2 November 2020}}</ref>
* [[Amazon DynamoDB|DynamoDB]] uses conditional update as an implementation of OCC.<ref>{{cite web | url = https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ConditionalUpdate| title = Working with Items and Attributes - Conditional Writes| access-date = 2 November 2020}}</ref>
* [[Kubernetes]] uses OCC when updating resources.<ref>{{cite web | url = https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#resource-operations-update | title = API Overview - Resource Operations| access-date = 3 November 2020}}</ref>
* [[Kubernetes]] uses OCC when updating resources.<ref>{{cite web | url = https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#resource-operations-update | title = API Overview - Resource Operations| access-date = 3 November 2020}}</ref>
Line 49: Line 49:
==External links==
==External links==
*{{cite journal|title=On optimistic methods for concurrency control|journal=ACM Transactions on Database Systems|date=June 1981|first=H. T.|last=Kung|author2=John T. Robinson|volume=6|issue=2|pages=213–226|doi=10.1145/319566.319567|citeseerx=10.1.1.101.8988|s2cid=61600099 }}
*{{cite journal|title=On optimistic methods for concurrency control|journal=ACM Transactions on Database Systems|date=June 1981|first=H. T.|last=Kung|author2=John T. Robinson|volume=6|issue=2|pages=213–226|doi=10.1145/319566.319567|citeseerx=10.1.1.101.8988|s2cid=61600099 }}
* Enterprise JavaBeans, 3.0, By Bill Burke, Richard Monson-Haefel, Chapter 16. Transactions, Section 16.3.5. Optimistic Locking, Publisher: O'Reilly, Pub Date: May 16, 2006, Print {{ISBN|0-596-00978-X}},
* Enterprise JavaBeans, 3.0, By Bill Burke, Richard Monson-Haefel, Chapter 16. Transactions, Section 16.3.5. Optimistic Locking, Publisher: O'Reilly, Pub Date: May 16, 2006,Print {{ISBN|0-596-00978-X}},
* {{cite conference | first = Andreas | last = Hollmann | title = Multi-Isolation: Virtues and Limitations | book-title = Multi-Isolation (what is between pessimistic and optimistic locking) | pages = 8 | publisher = Happy-Guys Software GbR | date = May 2009 | location = 01069 Gutzkovstr. 30/F301.2, Dresden | url = http://www.andrej-hollmann.de/images/stories/informatik/multi-isolation-part-1.pdf | access-date = 2013-05-16 }}{{dead link|date=March 2018 |bot=InternetArchiveBot |fix-attempted=yes }}
* {{cite conference | first = Andreas | last = Hollmann | title = Multi-Isolation: Virtues and Limitations | book-title = Multi-Isolation (what is between pessimistic and optimistic locking) | pages = 8 | publisher = Happy-Guys Software GbR | date = May 2009 | location = 01069 Gutzkovstr. 30/F301.2, Dresden | url = http://www.andrej-hollmann.de/images/stories/informatik/multi-isolation-part-1.pdf | access-date = 2013-05-16 }}{{dead link|date=March 2018 |bot=InternetArchiveBot |fix-attempted=yes }}


By publishing changes, you agree to the Terms of Use, and you irrevocably agree to release your contribution under the CC BY-SA 4.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel Editing help (opens in new window)

Copy and paste: – — ° ′ ″ ≈ ≠ ≤ ≥ ± − × ÷ ← → · §   Cite your sources: <ref></ref>


{{}}   {{{}}}   |   []   [[]]   [[Category:]]   #REDIRECT [[]]   &nbsp;   <s></s>   <sup></sup>   <sub></sub>   <code></code>   <pre></pre>   <blockquote></blockquote>   <ref></ref> <ref name="" />   {{Reflist}}   <references />   <includeonly></includeonly>   <noinclude></noinclude>   {{DEFAULTSORT:}}   <nowiki></nowiki>   <!-- -->   <span class="plainlinks"></span>


Symbols: ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶   # ∞   ‹› «»   ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥   ♠ ♣ ♥ ♦   𝄫 ♭ ♮ ♯ 𝄪   © ® ™
Latin: A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ   B b   C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç   D d Ď ď Đ đ Ḍ ḍ Ð ð   E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ẹ ẹ Ɛ ɛ Ǝ ǝ Ə ə   F f   G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ   H h Ĥ ĥ Ħ ħ Ḥ ḥ   I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į Ị ị   J j Ĵ ĵ   K k Ķ ķ   L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ   M m Ṃ ṃ   N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ   O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ọ ọ Ő ő Ø ø Œ œ   Ɔ ɔ   P p   Q q   R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ   S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß   T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ   U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ụ ụ Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ   V v   W w Ŵ ŵ   X x   Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ   Z z Ź ź Ż ż Ž ž   ß Ð ð Þ þ Ŋ ŋ Ə ə
Greek: Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ   Α α Β β Γ γ Δ δ   Ε ε Ζ ζ Η η Θ θ   Ι ι Κ κ Λ λ Μ μ   Ν ν Ξ ξ Ο ο Π π   Ρ ρ Σ σ ς Τ τ Υ υ   Φ φ Χ χ Ψ ψ Ω ω   {{Polytonic|}}
Cyrillic: А а Б б В в Г г   Ґ ґ Ѓ ѓ Д д Ђ ђ   Е е Ё ё Є є Ж ж   З з Ѕ ѕ И и І і   Ї ї Й й Ј ј К к   Ќ ќ Л л Љ љ М м   Н н Њ њ О о П п   Р р С с Т т Ћ ћ   У у Ў ў Ф ф Х х   Ц ц Ч ч Џ џ Ш ш   Щ щ Ъ ъ Ы ы Ь ь   Э э Ю ю Я я   ́
IPA: t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ   ɸ β θ ð ʃ ʒ ɕ ʑ ʂ ʐ ç ʝ ɣ χ ʁ ħ ʕ ʜ ʢ ɦ   ɱ ɳ ɲ ŋ ɴ   ʋ ɹ ɻ ɰ   ʙ ⱱ ʀ ɾ ɽ   ɫ ɬ ɮ ɺ ɭ ʎ ʟ   ɥ ʍ ɧ   ʼ   ɓ ɗ ʄ ɠ ʛ   ʘ ǀ ǃ ǂ ǁ   ɨ ʉ ɯ   ɪ ʏ ʊ   ø ɘ ɵ ɤ   ə ɚ   ɛ œ ɜ ɝ ɞ ʌ ɔ   æ   ɐ ɶ ɑ ɒ   ʰ ʱ ʷ ʲ ˠ ˤ ⁿ ˡ   ˈ ˌ ː ˑ ̪   {{IPA|}}

Wikidata entities used in this page

Pages transcluded onto the current version of this page (help):