Understanding the lock manager internals with the fb lock print utility
Upcoming SlideShare
Loading in...5
×
 

Understanding the lock manager internals with the fb lock print utility

on

  • 2,398 views

This session will provide a short introduction to the Firebird lock manager and its usage patterns. It will describe how the lock manager can affect the performance of highly loaded systems and ...

This session will provide a short introduction to the Firebird lock manager and its usage patterns. It will describe how the lock manager can affect the performance of highly loaded systems and outlines the possible bottlenecks and other problems like unexpected lock-ups/freezes that may require special analysis. The structure of the lock table will also be explained.
It will also include a detailed description of the fb_lock_print utility and its usage that will enable the research of issues that are related to the lock manager. A few practical examples illustrating how to analyze the utility output will be provided. This session is mainly of interest to Classic Server users and DBAs.

Statistics

Views

Total Views
2,398
Views on SlideShare
2,397
Embed Views
1

Actions

Likes
1
Downloads
22
Comments
0

1 Embed 1

http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Understanding the lock manager internals with the fb lock print utility Understanding the lock manager internals with the fb lock print utility Presentation Transcript

  • Understanding the lock manager with the fb_lock_print utility Dmitry Yemanov mailto:dimitr@firebirdsql.org Firebird Project http://www.firebirdsql.org/
  • Synchronization in Firebird
    • Internal vs external locks
      • Mutexes, spinlocks, RW locks, latches
      • Lock manager
    • Features of the global locks
      • Multiple states (SR, PR, SW, PW, EX)
      • Blocking notifications
      • Deadlock detection
      • Monitoring abilities
  • Lock Types and their Usage
    • Lock types
      • Database lock
      • Existence locks (table, procedure, index, collation)
      • Table access locks
      • Transaction locks
      • Sweep, shadow, monitoring, etc locks
      • Page locks (!)
  • Lock Types and their Usage
    • Lock types
    LCK_database = 1 // Root of lock tree LCK_relation = 2 // Individual relation lock LCK_bdb = 3 // Individual buffer block LCK_tra = 4 // Individual transaction lock LCK_rel_exist = 5 // Relation existence lock LCK_idx_exist = 6 // Index existence lock LCK_attachment = 7 // Attachment lock ...
  • Locks and Firebird Architectures
    • SuperServer
      • No page locks
      • Small lock table
      • Fast LM operations
    • Classic and SuperClassic
      • Page locks are widely used
      • Large lock table
      • LM operations may require IPC
  • Lock Manager in Classic IPC IPC IPC Connection 1 Connection 2 fb_inet_server fb_inet_server fb_lock_mgr Lock table (shmem)
  • Inside the Lock Table
    • Block types
      • Header section
      • Lock owners
      • Lock resources
      • Lock requests
    • Internals
      • Single mutex around the shmem region
      • Remappings
      • Hash table of lock keys
  • Inside the Lock Table Lock resource Series: page lock Key: 01:75 State: PR Lock request 1 PR (granted) Lock request 3 EX (pending) Lock request 4 EX (pending) Owner 1 PID = 1008 Owner 3 PID = 870 Owner 4 PID = 114 Lock request 2 PR (granted) Owner 2 PID = 788
  • Inside the Lock Table
    • Owner states
      • Waiting = 0x4
      • Signaled = 0x10
    • Request states
      • Pending = 0x2
      • Blocking = 0x1
      • Blocking seen = 0x100
  • Tuning the Lock Manager
    • Configuration options
      • LockMemSize (1MB) ~= <cache pages> * <max connections> * 100
      • LockSemCount (32) – deprecated in v2.5
      • LockHashSlots (1009)
    • Other considerations
      • FIREBIRD_LOCK envvar
  • Using the Lock Print Utility
    • Output control switches
      • -o [wners]
      • -l [ocks]
      • -r [equests]
      • -s [eries] <number>
      • -a [ll]
      • -w [ait list]
    • Default output
      • Header and owners only
  • Using the Lock Print Utility
    • Interactive mode
      • -i [aotw] <number> <number>
      • Acquires, operations, types, waits
      • Seconds and intervals
    • Other options
      • -c
      • -d <database> or -f <lock file>
      • -m
  • Questions?