Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Firebird Performance counters in details

1,434 views

Published on

"Firebird Performance Counters in details", bt Dmitry Yemanov, core Firebird architect.

Published in: Software
  • Be the first to comment

Firebird Performance counters in details

  1. 1. Firebird ppeerrffoorrmmaannccee ccoouunntteerrss iinn ddeettaaiillss Dmitry Yemanov mailto:dimitr@firebirdsql.org Firebird Project http://www.firebirdsql.org/
  2. 2. TThhaannkk yyoouu FIREBIRD INTERNATIONAL CONFERENCE '2014 2
  3. 3. AAnnaallyyssiinngg bboottttlleenneecckkss Disk Database Temporary files FIREBIRD INTERNATIONAL CONFERENCE '2014 3
  4. 4. AAnnaallyyssiinngg bboottttlleenneecckkss Disk Database Temporary files Memory Static (cache) Dynamic (pools) Shared FIREBIRD INTERNATIONAL CONFERENCE '2014 4
  5. 5. AAnnaallyyssiinngg bboottttlleenneecckkss CPU, waits, etc Real execution time User/kernel time Was time spent for work or waiting? What operations were performed? FIREBIRD INTERNATIONAL CONFERENCE '2014 5
  6. 6. LLeeggaaccyy ppeerrffoorrmmaannccee ccoouunntteerrss Page level Fetches, reads, marks, writes Shared in SS, per connection in CS Available via API FIREBIRD INTERNATIONAL CONFERENCE '2014 6
  7. 7. LLeeggaaccyy ppeerrffoorrmmaannccee ccoouunntteerrss Page level Fetches, reads, marks, writes Shared in SS, per connection in CS Available via API Record level Selected (seq/idx), inserted, updated, deleted etc Per connection and per table Available via API FIREBIRD INTERNATIONAL CONFERENCE '2014 7
  8. 8. IImmpprroovveemmeennttss iinn FFiirreebbiirrdd 22..xx Multi-level aggregated counters Database (SS only) Connection Transaction Statement Nested PSQL call (procedure / trigger) FIREBIRD INTERNATIONAL CONFERENCE '2014 8
  9. 9. IImmpprroovveemmeennttss iinn FFiirreebbiirrdd 22..xx Multi-level aggregated counters Database Connection 1 Connection 2 Transaction 1 Transaction 2 Statement 1 Statement 1 FIREBIRD INTERNATIONAL CONFERENCE '2014 9
  10. 10. IImmpprroovveemmeennttss iinn FFiirreebbiirrdd 22..xx New interfaces Monitoring tables Trace/audit FIREBIRD INTERNATIONAL CONFERENCE '2014 10
  11. 11. PPaaggee lleevveell ccoouunntteerrss Page reads From disk to the page cache (physical reads) Usually means a cache miss FIREBIRD INTERNATIONAL CONFERENCE '2014 11
  12. 12. PPaaggee lleevveell ccoouunntteerrss Page reads From disk to the page cache (physical reads) Usually means a cache miss Page fetches Access page in cache (logical reads) Includes both cache hits and cache misses Corresponds to a shared page lock / latch FIREBIRD INTERNATIONAL CONFERENCE '2014 12
  13. 13. PPaaggee lleevveell ccoouunntteerrss Page reads From disk to the page cache (physical reads) Usually means a cache miss Page fetches Access page in cache (logical reads) Includes both cache hits and cache misses Corresponds to a shared page lock / latch Cache hit ratio = 1 - reads / fetches ??? FIREBIRD INTERNATIONAL CONFERENCE '2014 13
  14. 14. PPaaggee lleevveell ccoouunntteerrss Page writes From the page cache to disk (physical writes) At transaction commit/rollback Cache is full of dirty pages Asynchronous notification is received (CS/SC) Immediately after modification FIREBIRD INTERNATIONAL CONFERENCE '2014 14
  15. 15. PPaaggee lleevveell ccoouunntteerrss Page writes From the page cache to disk (physical writes) At transaction commit/rollback Cache is full of dirty pages Asynchronous notification is received (CS/SC) Immediately after modification Page marks Access page in cache (logical writes) Corresponds to an exclusive page lock / latch FIREBIRD INTERNATIONAL CONFERENCE '2014 15
  16. 16. RReeccoorrdd lleevveell ccoouunntteerrss Sequential record reads Records retrieved through a full table scan Includes sweep Indexed record reads Records retrieved positionally Includes bitmap index scans, index navigational walks, DBKEY based retrievals FIREBIRD INTERNATIONAL CONFERENCE '2014 16
  17. 17. RReeccoorrdd lleevveell ccoouunntteerrss Record inserts, updates, deletes Pretty obvious, huh? FIREBIRD INTERNATIONAL CONFERENCE '2014 17
  18. 18. RReeccoorrdd lleevveell ccoouunntteerrss Record inserts, updates, deletes Pretty obvious, huh? Record backouts Latest (uncommitted) version removed Happens after savepoint rollback, explicit or implicit May happen after transaction rollback FIREBIRD INTERNATIONAL CONFERENCE '2014 18
  19. 19. RReeccoorrdd lleevveell ccoouunntteerrss Record purges Old versions removed while keeping the primary version in place Outdated versions found while chasing FIREBIRD INTERNATIONAL CONFERENCE '2014 19
  20. 20. RReeccoorrdd lleevveell ccoouunntteerrss Record purges Old versions removed while keeping the primary version in place Outdated versions found while chasing Record expunges Whole version chains removed, along with the primary version Record is deleted and nobody is interested FIREBIRD INTERNATIONAL CONFERENCE '2014 20
  21. 21. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Record repeated reads Record is retrieved multiple times BEFORE triggers Sort-based updates/deletes FIREBIRD INTERNATIONAL CONFERENCE '2014 21
  22. 22. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Record repeated reads Record is retrieved multiple times BEFORE triggers Sort-based updates/deletes Record locks Record is selected usng WITH LOCK clause FIREBIRD INTERNATIONAL CONFERENCE '2014 22
  23. 23. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Record waits Attempts to update/delete/lock record owned by a concurrent active transaction Transaction is in the WAIT mode FIREBIRD INTERNATIONAL CONFERENCE '2014 23
  24. 24. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Record waits Attempts to update/delete/lock record owned by a concurrent active transaction Transaction is in the WAIT mode Record conflicts Unsuccessful attempts to update/delete/lock record owned by a concurrent active transaction UPDATE CONFLICT is reported FIREBIRD INTERNATIONAL CONFERENCE '2014 24
  25. 25. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Backversion reads Versions chased while finding a visible one Means old snapshots FIREBIRD INTERNATIONAL CONFERENCE '2014 25
  26. 26. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx Backversion reads Versions chased while finding a visible one Means old snapshots Fragment reads Fragmented records Means extra page fetches/reads FIREBIRD INTERNATIONAL CONFERENCE '2014 26
  27. 27. NNeeww rreeccoorrdd lleevveell ccoouunntteerrss iinn vv33..xx MON$TABLE_STATS MON$RECORD_STATS MON$STATS_ID MON$STATS_GROUP MON$TABLE_NAME MON$RECORD_STATS_ID MON$STATS_ID MON$STATS_GROUP MON$RECORD_SEQ_READS MON$RECORD_IDX_READS etc FIREBIRD INTERNATIONAL CONFERENCE '2014 27
  28. 28. TTOODDOO:: ppaaggee lleevveell ccoouunntteerrss Page writes (expanded) Regular writes (immediate / commit / rollback) Overflow writes Asynchronous writes FIREBIRD INTERNATIONAL CONFERENCE '2014 28
  29. 29. TTOODDOO:: ppaaggee lleevveell ccoouunntteerrss Page writes (expanded) Regular writes (immediate / commit / rollback) Overflow writes Asynchronous writes Page waits How many times page requests waited Shows contention inside the page cache FIREBIRD INTERNATIONAL CONFERENCE '2014 29
  30. 30. TTOODDOO:: iinnddeexx ccoouunntteerrss Possible metrics Index scans Node inserts / deletes Bucket splits / merges Keys scanned / compared while searching Reported per index MON$INDEX_STATS FIREBIRD INTERNATIONAL CONFERENCE '2014 30
  31. 31. TTOODDOO:: tteemmppoorraarryy ssppaaccee ccoouunntteerrss Operation metrics Reads / writes resolved through the cache Reads / writes redirected to temp files I/O amount metrics Bytes read / written through the cache Bytes read / written from/to temp files FIREBIRD INTERNATIONAL CONFERENCE '2014 31
  32. 32. TTOODDOO:: ttiimmee ssttaattiissttiiccss Elapsed time Total inside the engine Spent in the user space Spent in the system / kernel space FIREBIRD INTERNATIONAL CONFERENCE '2014 32
  33. 33. TTOODDOO:: ttiimmee ssttaattiissttiiccss Elapsed time Total inside the engine Spent in the user space Spent in the system / kernel space Wait time Database (and maybe temp files) I/O Page cache waits Transaction waits FIREBIRD INTERNATIONAL CONFERENCE '2014 33
  34. 34. TTOODDOO:: iinntteeggrraattiioonn Collecting the statistics StatsD, CollectD Reporting / analyzing Graphite / Graphene Other tools Nagios, Cacti, Zabbix FIREBIRD INTERNATIONAL CONFERENCE '2014 34
  35. 35. QQuueessttiioonnss?? mailto:dimitr@firebirdsql.org FIREBIRD INTERNATIONAL CONFERENCE '2014 35

×