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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Understanding the lock manager internals with the fb lock print utility

2,306

Published on

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.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,306
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
30
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Understanding the lock manager with the fb_lock_print utility Dmitry Yemanov mailto:dimitr@firebirdsql.org Firebird Project http://www.firebirdsql.org/
  • 2. Synchronization in Firebird <ul><li>Internal vs external locks </li></ul><ul><ul><li>Mutexes, spinlocks, RW locks, latches
  • 3. Lock manager </li></ul></ul><ul><li>Features of the global locks </li></ul><ul><ul><li>Multiple states (SR, PR, SW, PW, EX)
  • 4. Blocking notifications
  • 5. Deadlock detection
  • 6. Monitoring abilities </li></ul></ul>
  • 7. Lock Types and their Usage <ul><li>Lock types </li></ul><ul><ul><li>Database lock
  • 8. Existence locks (table, procedure, index, collation)
  • 9. Table access locks
  • 10. Transaction locks
  • 11. Sweep, shadow, monitoring, etc locks </li></ul></ul><ul><ul><li>Page locks (!) </li></ul></ul>
  • 12. Lock Types and their Usage <ul><li>Lock types </li></ul>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 ...
  • 13. Locks and Firebird Architectures <ul><li>SuperServer </li></ul><ul><ul><li>No page locks
  • 14. Small lock table
  • 15. Fast LM operations </li></ul></ul><ul><li>Classic and SuperClassic </li></ul><ul><ul><li>Page locks are widely used
  • 16. Large lock table
  • 17. LM operations may require IPC </li></ul></ul>
  • 18. Lock Manager in Classic IPC IPC IPC Connection 1 Connection 2 fb_inet_server fb_inet_server fb_lock_mgr Lock table (shmem)
  • 19. Inside the Lock Table <ul><li>Block types </li></ul><ul><ul><li>Header section
  • 20. Lock owners
  • 21. Lock resources
  • 22. Lock requests </li></ul></ul><ul><li>Internals </li></ul><ul><ul><li>Single mutex around the shmem region
  • 23. Remappings
  • 24. Hash table of lock keys </li></ul></ul>
  • 25. 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
  • 26. Inside the Lock Table <ul><li>Owner states </li></ul><ul><ul><li>Waiting = 0x4
  • 27. Signaled = 0x10 </li></ul></ul><ul><li>Request states </li></ul><ul><ul><li>Pending = 0x2
  • 28. Blocking = 0x1
  • 29. Blocking seen = 0x100 </li></ul></ul>
  • 30. Tuning the Lock Manager <ul><li>Configuration options </li></ul><ul><ul><li>LockMemSize (1MB) ~= &lt;cache pages&gt; * &lt;max connections&gt; * 100
  • 31. LockSemCount (32) – deprecated in v2.5
  • 32. LockHashSlots (1009) </li></ul></ul><ul><li>Other considerations </li></ul><ul><ul><li>FIREBIRD_LOCK envvar </li></ul></ul>
  • 33. Using the Lock Print Utility <ul><li>Output control switches </li></ul><ul><ul><li>-o [wners]
  • 34. -l [ocks]
  • 35. -r [equests]
  • 36. -s [eries] &lt;number&gt;
  • 37. -a [ll]
  • 38. -w [ait list] </li></ul></ul><ul><li>Default output </li></ul><ul><ul><li>Header and owners only </li></ul></ul>
  • 39. Using the Lock Print Utility <ul><li>Interactive mode </li></ul><ul><ul><li>-i [aotw] &lt;number&gt; &lt;number&gt;
  • 40. Acquires, operations, types, waits
  • 41. Seconds and intervals </li></ul></ul><ul><li>Other options </li></ul><ul><ul><li>-c
  • 42. -d &lt;database&gt; or -f &lt;lock file&gt;
  • 43. -m </li></ul></ul>
  • 44. Questions?

×