익명 사용자
로그인하지 않음
토론
기여
계정 만들기
로그인
IT 위키
검색
Distributed Two-Phase Locking
편집하기
IT 위키
이름공간
문서
토론
더 보기
더 보기
문서 행위
읽기
편집
원본 편집
역사
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
'''Distributed Two-Phase Locking (Distributed 2PL)''' is a concurrency control protocol used in distributed database systems to ensure global serializability. In this protocol, each site manages locks independently while coordinating with other sites to maintain consistency across the distributed system. ==Key Concepts== *'''Global Serializability:''' Ensures that the execution of distributed transactions is equivalent to a serial execution. *'''Distributed Lock Management:''' Each site manages its own locks, but transactions may need to acquire locks from multiple sites. *'''Two-Phase Locking:''' Transactions follow the standard Two-Phase Locking protocol: **'''Growing Phase:''' Locks are acquired but not released. **'''Shrinking Phase:''' Locks are released but no new locks are acquired. ==How Distributed 2PL Works== Distributed 2PL operates as follows: #Each data item is associated with a site that manages its locks. #A transaction requesting access to data at multiple sites must acquire locks from all relevant sites. #Each site enforces Two-Phase Locking for the data items it manages. #Global consistency is ensured by coordinating lock acquisition across sites. ==Advantages== *'''Decentralized Lock Management:''' Each site manages its own locks, reducing the risk of a single point of failure. *'''Flexibility:''' The protocol works well in systems with geographically distributed nodes. *'''Scalability:''' Handles large-scale systems by distributing lock management across multiple sites. ==Limitations== *'''High Communication Overhead:''' Coordination between sites increases network traffic and latency. *'''Deadlocks Across Sites:''' Distributed transactions can create inter-site deadlocks that are more complex to resolve. *'''Complex Implementation:''' Managing locks and ensuring consistency across multiple sites adds significant complexity. ==Example of Distributed 2PL== Consider a distributed database with two sites: *Site 1 manages data item A. *Site 2 manages data item B. ===Scenario=== Transaction T1 and T2 execute as follows: {| class="wikitable" !Step!!Transaction T1!!Transaction T2!!Actions at Sites |- |1||BEGIN TRANSACTION||BEGIN TRANSACTION||Both transactions start. |- |2||READ(A)||-||T1 requests a shared lock for A from Site 1. |- |3||-||WRITE(A)||T2 requests an exclusive lock for A from Site 1 but must wait as T1 holds a shared lock. |- |4||READ(B)||-||T1 requests a shared lock for B from Site 2. |- |5||-||WRITE(B)||T2 requests an exclusive lock for B from Site 2 but must wait as T1 holds a shared lock. |- |6||COMMIT||-||T1 releases locks on A and B. |- |7||-||WRITE(A), WRITE(B)||T2 acquires exclusive locks on A and B and completes its transaction. |}This example demonstrates how locks are acquired and released across multiple sites, ensuring consistency while managing contention. ==Deadlock Handling in Distributed 2PL== Distributed 2PL introduces the risk of inter-site deadlocks. Common strategies to handle deadlocks include: *'''Timeouts:''' Abort transactions that wait too long for locks. *'''Wait-For Graphs:''' Use a global wait-for graph to detect cycles and resolve deadlocks. *'''Deadlock Prevention:''' Enforce a predefined order for acquiring locks across sites. ==Comparison with Other 2PL Variants== {| class="wikitable" !Feature!!Distributed 2PL!!Centralized 2PL!!Primary Copy 2PL |- |Lock Management||Fully distributed across sites||Centralized at a single site||Managed by the primary copy for each data item |- |Fault Tolerance||High (no single point of failure)||Low (single point of failure)||Moderate (failure of primary copy affects data availability) |- |Communication Overhead||High (inter-site communication)||Low||Moderate |- |Scalability||High||Limited||High (for read-heavy workloads) |} ==Applications== Distributed 2PL is used in: *'''Distributed Databases:''' Ensures consistency in systems where data is partitioned across multiple nodes. *'''Global Transaction Systems:''' Supports transactions that span multiple geographical regions. *'''Cloud Databases:''' Provides concurrency control for distributed cloud-based systems. ==Challenges== *'''Network Latency:''' Communication delays between sites can impact transaction performance. *'''Replication Consistency:''' Ensuring consistency across replicas while maintaining performance. *'''Deadlock Resolution:''' Inter-site deadlocks are harder to detect and resolve compared to single-site systems. ==See Also== *[[Two-Phase Locking]] *[[Distributed Database]] *[[Concurrency Control]] *[[Deadlock Detection]] *[[Primary Copy 2PL]] *[[Centralized 2PL]] *[[Replication]] *[[Serializability]] [[Category:Database]]
요약:
IT 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는
IT 위키:저작권
문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다.
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기
둘러보기
대문
최근 바뀜
광고
위키 도구
위키 도구
특수 문서 목록
문서 도구
문서 도구
사용자 문서 도구
더 보기
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
문서 기록