Suche senden
Hochladen
Understanding PostgreSQL LW Locks
•
12 gefällt mir
•
12,900 views
Jignesh Shah
Folgen
Technologie
Melden
Teilen
Melden
Teilen
1 von 26
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
PostgreSQL Performance Tuning
PostgreSQL Performance Tuning
elliando dias
PostgreSQL replication
PostgreSQL replication
NTT DATA OSS Professional Services
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
Masahiko Sawada
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Jignesh Shah
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
Alexander Korotkov
Tuning Autovacuum in Postgresql
Tuning Autovacuum in Postgresql
Mydbops
Vacuum in PostgreSQL
Vacuum in PostgreSQL
Rafia Sabih
Empfohlen
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
PostgreSQL Performance Tuning
PostgreSQL Performance Tuning
elliando dias
PostgreSQL replication
PostgreSQL replication
NTT DATA OSS Professional Services
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
Masahiko Sawada
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Jignesh Shah
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
Alexander Korotkov
Tuning Autovacuum in Postgresql
Tuning Autovacuum in Postgresql
Mydbops
Vacuum in PostgreSQL
Vacuum in PostgreSQL
Rafia Sabih
Mastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
HOT Understanding this important update optimization
HOT Understanding this important update optimization
Grant McAlister
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
PgDay.Seoul
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
Zalando Technology
PostgreSQL Deep Internal
PostgreSQL Deep Internal
EXEM
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
Vacuum徹底解説
Vacuum徹底解説
Masahiko Sawada
Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
HostedbyConfluent
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
Command Prompt., Inc
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
Jeremy Schneider
Apache Kafka 0.11 の Exactly Once Semantics
Apache Kafka 0.11 の Exactly Once Semantics
Yoshiyasu SAEKI
Getting started with postgresql
Getting started with postgresql
botsplash.com
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
OpenStack Korea Community
Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer
Sameer Kumar
問合せ最適化インサイド
問合せ最適化インサイド
Takahiro Itagaki
PostgreSQL Replication High Availability Methods
PostgreSQL Replication High Availability Methods
Mydbops
The PostgreSQL Query Planner
The PostgreSQL Query Planner
Command Prompt., Inc
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
Jignesh Shah
Weitere ähnliche Inhalte
Was ist angesagt?
Mastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
HOT Understanding this important update optimization
HOT Understanding this important update optimization
Grant McAlister
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
PgDay.Seoul
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
Zalando Technology
PostgreSQL Deep Internal
PostgreSQL Deep Internal
EXEM
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
Vacuum徹底解説
Vacuum徹底解説
Masahiko Sawada
Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
HostedbyConfluent
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
Command Prompt., Inc
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
Jeremy Schneider
Apache Kafka 0.11 の Exactly Once Semantics
Apache Kafka 0.11 の Exactly Once Semantics
Yoshiyasu SAEKI
Getting started with postgresql
Getting started with postgresql
botsplash.com
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
OpenStack Korea Community
Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer
Sameer Kumar
問合せ最適化インサイド
問合せ最適化インサイド
Takahiro Itagaki
PostgreSQL Replication High Availability Methods
PostgreSQL Replication High Availability Methods
Mydbops
The PostgreSQL Query Planner
The PostgreSQL Query Planner
Command Prompt., Inc
Was ist angesagt?
(20)
Mastering PostgreSQL Administration
Mastering PostgreSQL Administration
HOT Understanding this important update optimization
HOT Understanding this important update optimization
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
PostgreSQL Deep Internal
PostgreSQL Deep Internal
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
Vacuum徹底解説
Vacuum徹底解説
Postgresql database administration volume 1
Postgresql database administration volume 1
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
Apache Kafka 0.11 の Exactly Once Semantics
Apache Kafka 0.11 の Exactly Once Semantics
Getting started with postgresql
Getting started with postgresql
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer
問合せ最適化インサイド
問合せ最適化インサイド
PostgreSQL Replication High Availability Methods
PostgreSQL Replication High Availability Methods
The PostgreSQL Query Planner
The PostgreSQL Query Planner
Andere mochten auch
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
Jignesh Shah
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
Jignesh Shah
SFPUG - DVDStore Performance Benchmark and PostgreSQL
SFPUG - DVDStore Performance Benchmark and PostgreSQL
Jignesh Shah
OLTP Performance Benchmark Review
OLTP Performance Benchmark Review
Jignesh Shah
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
Jignesh Shah
My experience with embedding PostgreSQL
My experience with embedding PostgreSQL
Jignesh Shah
Best Practices of running PostgreSQL in Virtual Environments
Best Practices of running PostgreSQL in Virtual Environments
Jignesh Shah
PostgreSQL and Linux Containers
PostgreSQL and Linux Containers
Jignesh Shah
Introduction to PgBench
Introduction to PgBench
Joshua Drake
PostgreSQL and Benchmarks
PostgreSQL and Benchmarks
Jignesh Shah
PostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized World
Jignesh Shah
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Jignesh Shah
Inside vacuum - 第一回PostgreSQLプレ勉強会
Inside vacuum - 第一回PostgreSQLプレ勉強会
Masahiko Sawada
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
Norishige Fukushima
5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL Performance
Command Prompt., Inc
Andere mochten auch
(16)
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
SFPUG - DVDStore Performance Benchmark and PostgreSQL
SFPUG - DVDStore Performance Benchmark and PostgreSQL
OLTP Performance Benchmark Review
OLTP Performance Benchmark Review
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
My experience with embedding PostgreSQL
My experience with embedding PostgreSQL
Best Practices of running PostgreSQL in Virtual Environments
Best Practices of running PostgreSQL in Virtual Environments
PostgreSQL and Linux Containers
PostgreSQL and Linux Containers
Introduction to PgBench
Introduction to PgBench
PostgreSQL and Benchmarks
PostgreSQL and Benchmarks
PostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized World
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Inside vacuum - 第一回PostgreSQLプレ勉強会
Inside vacuum - 第一回PostgreSQLプレ勉強会
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL Performance
Ähnlich wie Understanding PostgreSQL LW Locks
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!
Boris Hristov
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!
Boris Hristov
sanlock overview and its consensus algorithms
sanlock overview and its consensus algorithms
Roger Zhou 周志强
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worlds
Arun Gupta
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
Arun Gupta
Locks
Locks
Vu Tran
[4DEV][Łódź] Michał Szynkiewicz - WildFly Swarm: JavaEE w świecie mikroserwisów
[4DEV][Łódź] Michał Szynkiewicz - WildFly Swarm: JavaEE w świecie mikroserwisów
PROIDEA
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
Arun Gupta
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
Roman Elizarov
Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed Durability
Mark Broadbent
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFish
Arun Gupta
Nexus1000V on KVM and OpenStack Integration
Nexus1000V on KVM and OpenStack Integration
openstackindia
OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFish
Arun Gupta
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
James Chen
lock, block & two smoking barrels
lock, block & two smoking barrels
Mark Broadbent
The nightmare of locking, blocking and isolation levels
The nightmare of locking, blocking and isolation levels
Boris Hristov
READPAST & Furious: Locking
READPAST & Furious: Locking
Mark Broadbent
Doulos coverage-tips-tricks
Doulos coverage-tips-tricks
Obsidian Software
A Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog Coverage
DVClub
Linux synchronization tools
Linux synchronization tools
mukul bhardwaj
Ähnlich wie Understanding PostgreSQL LW Locks
(20)
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!
sanlock overview and its consensus algorithms
sanlock overview and its consensus algorithms
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
Locks
Locks
[4DEV][Łódź] Michał Szynkiewicz - WildFly Swarm: JavaEE w świecie mikroserwisów
[4DEV][Łódź] Michał Szynkiewicz - WildFly Swarm: JavaEE w świecie mikroserwisów
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed Durability
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFish
Nexus1000V on KVM and OpenStack Integration
Nexus1000V on KVM and OpenStack Integration
OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFish
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
lock, block & two smoking barrels
lock, block & two smoking barrels
The nightmare of locking, blocking and isolation levels
The nightmare of locking, blocking and isolation levels
READPAST & Furious: Locking
READPAST & Furious: Locking
Doulos coverage-tips-tricks
Doulos coverage-tips-tricks
A Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog Coverage
Linux synchronization tools
Linux synchronization tools
Kürzlich hochgeladen
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
The Digital Insurer
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
hans926745
Kürzlich hochgeladen
(20)
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
Understanding PostgreSQL LW Locks
1.
Understanding PostgreSQL LWLocks
Jignesh Shah Staff Engineer, VMware Inc PgCon 2011 - Ottawa
2.
About MySelf § Joined
VMware in 2010 q PostgreSQL performance on vSphere § Previously at Sun Microsystems from 2000-‐2010 q Database Performance on Solaris/Sun Systems § Work with PostgreSQL Performance Community q Scaling, BoIlenecks using various workloads § My Blog: hIp://jkshah.blogspot.com © 2011 VMware Inc 2
3.
Content v What are PostgreSQL
LWLocks ? v Understanding modes of LWLock v LWLocks API v Architecture of the LWLocks Framework v Internals of LWLock Wait List v Ways to monitors the events related to LWLocks v Top LWLocks. © 2011 VMware Inc 3
4.
What are PostgreSQL
LWLocks? § LWLocks – Light Weight Locks of PostgreSQL § Primary Intent q Mutually Exclusive access to shared memory structures § Offers Shared and Exclusive mode § Not to be confused with the PostgreSQL Locks § PostgreSQL Locks depends on LWLocks to protect its shared state § Uses SpinLockAcquire/SpinLockRelease and PGSemaphoreLock/PGSemaphoreUnlock © 2011 VMware Inc 4
5.
Understanding Modes of
LWLocks ExclusiveLock § For a parcular lockid there can be only 1 exclusivelock held (no shared locks and no other exclusive lock for the lockid) SharedLock • For a parcular lockid there can be 1 or more SharedLock held (no exclusive lock for the lockid) © 2011 VMware Inc 5
6.
LWLocks API § LWLockAssign(void)
§ Get a dynamic LWLock number (mostly at module load) § LWLockAcquire(LWLockId lockid, LWLockMode mode) § Waits ll Lock is acquired in EXCLUSIVE or SHARED mode § LWLockCondionalAcquire(LWLockId lockid, LWLockMode mode) § Returns False if it not available (Non-‐blocking) § LWLockRelease(LWLockId lockid) § Releases the lock § LWLockReleaseAll (void) § Used aaer an ERROR to cleanup § LWLockHeldByMe (LWLockId lockid) § Debug support test © 2011 VMware Inc 6
7.
Architecture Flow of
LWLocks LWLockCondionalAcquire • Easy lock it if available else return false (Non-‐blocking) LWLockAcquire • Lock if available or else put me in wait queue (FIFO) and got to sleep on a semaphore (and loop) • Only return when lock is available (Blocking) LWLockRelease • Release the Lock and if there are no more shared locks remaining then wake up the next process waing in the wait queue © 2011 VMware Inc 7
8.
Wait Queue List •
Wait Queue is protected by a mutex which is accessed using SpinLocks • When the lock is released and there are no more shared locks pending then the process releasing the lock will wake the next waiter as follows • If the next process in wait queue is waing for an EXCLUSIVE mode , only that process is removed from the queue and wakes them up • Or since the next process is waing for SHARED mode, it will try to remove as many consecuve SHARED mode processes and wake them up © 2011 VMware Inc 8
9.
Lock Acquisition Internals
Spins on ‘lock’ mutex Sleep on its process wait semaphore Lock • If Not Add to Wait Queue List Available • Release ‘lock’ mutex Release ‘lock’ mutex © 2011 VMware Inc 9
10.
Lock Release Internals
Spins on ‘lock’ mutex Release Lock • Wake Up process next in FIFO Shared • If it is Shared wake up all sequenal shared waiters Locks ? Release ‘lock’ mutex © 2011 VMware Inc 10
11.
LWLocks Wait Queue
List FIFO Example • Consider something 80-‐20 Shared /Exclusive rao S S S S E S E S S S S It will wake up first 5 shared locks then wait ll all of them releases the lock before waking up the process asking for Exclusive It will do only exclusive one then and one it releases the lock, wakes up the next 1 shared one © 2011 VMware Inc 11
12.
Observations about LWLocks
Wait Queue List • All Operaons on Wait Queue List are serialized • Not scalable on SMP architecture • Currently only FIFO supported • No restricon on shared wakeups © 2011 VMware Inc 12
13.
LWLocks – Defined
in lwlock.h typedef enum LWLockId { BufFreelistLock, ShmemIndexLock, OidGenLock, XidGenLock, SInvalWriteLock, ProcArrayLock, WALInsertLock, SInvalReadLock, WALWriteLock, ControlFileLock, CheckpointLock, CLogControlLock, SubtransControlLock, MultiXactGenLock, MultiXactOffsetControlLock, MultiXactMemberControlLock, RelCacheInitLock, BgWriterCommLock, TwoPhaseStateLock, TablespaceCreateLock, BtreeVacuumLock, AddinShmemInitLock, AutovacuumLock, AutovacuumScheduleLock, SyncScanLock, RelationMappingLock, AsyncCtlLock, AsyncQueueLock, SerializableXactHashLock, SerializableFinishedListLock, SerializablePredicateLockListLock, OldSerXidLock, SyncRepLock, /* Individual lock IDs end here */ FirstBufMappingLock, FirstLockMgrLock = FirstBufMappingLock + NUM_BUFFER_PARTITIONS, /*16 */ FirstPredicateLockMgrLock = FirstLockMgrLock + NUM_LOCK_PARTITIONS, /* must be last except for MaxDynamicLWLock: */ NumFixedLWLocks = FirstPredicateLockMgrLock + NUM_PREDICATELOCK_PARTITIONS, MaxDynamicLWLock = 1000000000 } LWLockId; © 2011 VMware Inc 13
14.
Monitoring LWLOCK_STAT • Special
build with LWLOCK_STAT defined LOCK_DEBUG • Puts debug messages in system alert log DYNAMIC TRACING (DTrace, SystemTap) • Recommended • Useful to find hot locks • Not for producon use, because it can make the server unstable © 2011 VMware Inc 14
15.
Dynamic Tracing for
LWLocks • postgresql-‐lwlock-‐wait-‐start(lockid,mode) • Postgresql-‐lwlock-‐wait-‐done(lockid,mode) • Postgresql-‐lwlock-‐acquire(lockid,mode) • Postgresql-‐lwlock-‐condacquire(lockid,mode) • Postgresql-‐lwlock-‐condacquire-‐fail(lockid,mode) • Postgresql-‐lwlock-‐release(lockid) © 2011 VMware Inc 15
16.
Example Monitoring using
Systemtap (DBT2) LOCKNAME LWID M W/A COUNT SUM-TIME(us) MAX-TIME(us) AVG-TIME(us) WALInsertLock 7 Ex W 14013 2746505 3955 195 WALWriteLock 8 Ex W 10006 25508653 286749 2549 LockMgrLock 55 Ex W 2035 203429 3323 99 LockMgrLock 45 Ex W 932 54297 2860 58 LockMgrLock 54 Ex W 673 24362 1062 36 ProcArrayLock 4 Ex W 515 15907 666 30 ProcArrayLock 4 Sh W 176 6064 97 34 LockMgrLock 56 Ex W 171 5826 376 34 CLogControlLock 11 Sh W 111 22490 6127 202 LockMgrLock 57 Ex W 101 5524 1326 54 LockMgrLock 59 Ex W 79 2883 347 36 CLogControlLock 11 Ex W 58 8543 4439 147 LockMgrLock 49 Ex W 57 1848 76 32 LockMgrLock 47 Ex W 57 3166 1468 55 © 2011 VMware Inc 16
17.
Top Locks -
WALWriteLock • Protects writes on WAL • Acquired when WAL records flushed to disk • Acquired when WAL Log switch occurs • Improve the underlying storage of pg_xlog • Synchronous_commit=off helps indirectly ( Do not wait for flush to the disk) • Full_page_writes=off also helps reduce the stress (but not recommended since resiliency goes down) © 2011 VMware Inc 17
18.
Top Locks -
WALInsertLock • Protects WAL Buffers • Increasing wal buffers may help though to only certain extent • Snychnrous_commit off will lead to increased pressure on this lock ( Not a bad thing ) • However eventually not much can be done once it gets to a big problem without new commits • Full_page_writes=off certainly helps (again not recommended since it reduces the resiliency of the database from write errors) © 2011 VMware Inc 18
19.
Top Locks -
ProcArrayLock • Protects ProcArray structure • It used to be that every transacon actually acquired this lock in exclusive mode before commit causing it to be a top lock • Fixed in 9.0 © 2011 VMware Inc 19
20.
Top Locks -
SInvalidReadLock • Protects sinval array • Readers take “Shared” SInvalReadLock • SICleanupQueue and other array-‐wide updates take “Excluslive” SInvalReadLock to lock out all readers • Long wait mes to acquire SInvalidReadLock generally results when the Shared Buffer pool is being stressed • Increase shared_buffers in postgresql.conf corresponding to acve data size © 2011 VMware Inc 20
21.
Top Locks -
CLogControlLock • Protects CLogControl structure • Generally not a problem • If it shows on the top lists check • $PGDATA/pg_clog should be on buffered file system © 2011 VMware Inc 21
22.
Example Monitoring using
Systemtap (Sysbench simple read) LOCKNAME LWID M W/A COUNT SUM-TIME(us) MAX-TIME(us) AVG-TIME(us) LockMgrLock 45 Ex W 85343 469682510 13152 5503 LockMgrLock 57 Ex W 57547 30903727 8313 537 LockMgrLock 44 Ex W 390 34061 1670 87 LockMgrLock 59 Ex W 375 41570 2032 110 LockMgrLock 56 Ex W 361 39685 1889 109 LockMgrLock 47 Ex W 344 24548 1564 71 LockMgrLock 54 Ex W 335 67770 2319 202 LockMgrLock 50 Ex W 325 44213 1690 136 LockMgrLock 49 Ex W 325 39280 1475 120 LockMgrLock 55 Ex W 323 39448 1584 122 LockMgrLock 48 Ex W 323 26982 1669 83 © 2011 VMware Inc 22
23.
Top Locks -
LockMgrLocks • Protects relaons • Sets of about 16 Lock Parons by default to handle all relaons • Each relaon is part of only one paron (irrespecve of size) © 2011 VMware Inc 23
24.
Other Locks -
BufMappingLocks • Protects regions of Buffers • Sets of about 16 Regions of Buffers by default to handle the whole Bufferpool • Only taken shared access © 2011 VMware Inc 24
25.
Problems with LWLock •
Overall system gravitates to certain top locks • Single mutex lock protects adding and depleng the wait queue • Not SMP Scalable • Chance for opmizaon out there • Performance limited to serialized rate the locks are processed © 2011 VMware Inc 25
26.
Questions / More
Information v Email: jshah@vmware.com v Learn more about PostgreSQL q hIp://www.postgresql.org v Blog: hIp://jkshah.blogspot.com © 2011 VMware Inc 26
Jetzt herunterladen