Firebird Tour 2017: Performance. Vlad Khorsun, Firebird Project

Similar documents
Firebird Tour 2017: Performance. Vlad Khorsun, Firebird Project

Firebird 3.0 statistics and plans

Advanced Trace API. Vlad Khorsun, Firebird Project. Advanced Trace API. Firebird Tour 2017

Firebird performance degradation: tests, myths and truth IBSurgeon, 2014

Firebird in 2011/2012: Development Review

Firebird databases recovery and protection for enterprises and ISVs. Alexey Kovyazin, IBSurgeon

Diagnosing and fixing Firebird performance problems

TUNING LINUX, WINDOWS AND FIREBIRD FOR HEAVY WORKLOAD

Mastering the art of indexing

Orphans, Corruption, Careful Write, and Logging, or Gfix says my database is CORRUPT or Database Integrity - then, now, future

Switching to Innodb from MyISAM. Matt Yonkovit Percona

MySQL Database Scalability

Working With Very Large Firebird Databases

STORING DATA: DISK AND FILES

Parser. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text.

PostgreSQL Performance The basics

NOTE: sorting using B-trees to be assigned for reading after we cover B-trees.

CS3600 SYSTEMS AND NETWORKS

How Firebird transactions work

Column Stores vs. Row Stores How Different Are They Really?

Accelerating OLTP performance with NVMe SSDs Veronica Lagrange Changho Choi Vijay Balakrishnan

Ingo Brenckmann Jochen Kirsten Storage Technology Strategists SAS EMEA Copyright 2003, SAS Institute Inc. All rights reserved.

CSE 190D Database System Implementation

Disks, Memories & Buffer Management

University of Waterloo Midterm Examination Sample Solution

ASN Configuration Best Practices

CSCI-GA Database Systems Lecture 8: Physical Schema: Storage

OS and Hardware Tuning

Synergetics-Standard-SQL Server 2012-DBA-7 day Contents

OS and HW Tuning Considerations!

SUPERTALENT ULTRADRIVE LE/ME PERFORMANCE IN APPLE MAC WHITEPAPER

CS510 Operating System Foundations. Jonathan Walpole

Performance of popular open source databases for HEP related computing problems

Quantifying FTK 3.0 Performance with Respect to Hardware Selection

Storage hierarchy. Textbook: chapters 11, 12, and 13

CSE 544 Principles of Database Management Systems

File Systems Management and Examples

Advanced Database Systems

Today: Secondary Storage! Typical Disk Parameters!

Database Architecture 2 & Storage. Instructor: Matei Zaharia cs245.stanford.edu

Kathleen Durant PhD Northeastern University CS Indexes

How to recover a failed Storage Spaces

Join Processing for Flash SSDs: Remembering Past Lessons

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

Outlines. Chapter 2 Storage Structure. Structure of a DBMS (with some simplification) Structure of a DBMS (with some simplification)

External Sorting. Chapter 13. Comp 521 Files and Databases Fall

ColumnStore Indexes. מה חדש ב- 2014?SQL Server.

SRM-Buffer: An OS Buffer Management SRM-Buffer: An OS Buffer Management Technique toprevent Last Level Cache from Thrashing in Multicores

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona

CSE380 - Operating Systems

TokuDB vs RocksDB. What to choose between two write-optimized DB engines supported by Percona. George O. Lorch III Vlad Lesin

Chapter 12: Query Processing. Chapter 12: Query Processing

SSDs vs HDDs for DBMS by Glen Berseth York University, Toronto

Using Transparent Compression to Improve SSD-based I/O Caches

CPSC 421 Database Management Systems. Lecture 11: Storage and File Organization

Choosing Hardware and Operating Systems for MySQL. Apr 15, 2009 O'Reilly MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

Storage and File Structure

Chapter 12: Query Processing

Preview. Memory Management

* Contributed while interning at SAP. September 1 st, 2017 PUBLIC

Managing the Database

12 Common Mistakes while Backing Up Databases

NEC Express5800 A2040b 22TB Data Warehouse Fast Track. Reference Architecture with SW mirrored HGST FlashMAX III

IBEXPERT GMBH WHITE PAPER

Azor: Using Two-level Block Selection to Improve SSD-based I/O caches

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Database Management Systems need to:

Firebird Conference 2012

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Chapter 7

CS370 Operating Systems

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

CS-537: Midterm Exam (Spring 2009) The Future of Processors, Operating Systems, and You

IBM V7000 Unified R1.4.2 Asynchronous Replication Performance Reference Guide

Some Practice Problems on Hardware, File Organization and Indexing

Indexing. Jan Chomicki University at Buffalo. Jan Chomicki () Indexing 1 / 25

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

PARALLEL & DISTRIBUTED DATABASES CS561-SPRING 2012 WPI, MOHAMED ELTABAKH

EsgynDB Enterprise 2.0 Platform Reference Architecture

BIG DATA AND HADOOP ON THE ZFS STORAGE APPLIANCE

HPE ProLiant DL580 Gen10 and Ultrastar SS300 SSD 195TB Microsoft SQL Server Data Warehouse Fast Track Reference Architecture

RAID in Practice, Overview of Indexing

Field Testing Buffer Pool Extension and In-Memory OLTP Features in SQL Server 2014

CS370 Operating Systems

NoVA MySQL October Meetup. Tim Callaghan VP/Engineering, Tokutek

Chapter 12: Query Processing

No compromises: distributed transactions with consistency, availability, and performance

EECS 482 Introduction to Operating Systems

Operating system Dr. Shroouq J.

CSI3131 Final Exam Review

Database Applications (15-415)

Virtual to physical address translation

Scaling with mongodb

Database Applications (15-415)

C13: Files and Directories: System s Perspective

Greenplum Architecture Class Outline

DELL EMC DATA DOMAIN SISL SCALING ARCHITECTURE

Veeam Backup & Replication on IBM Cloud Solution Architecture

CIS 601 Graduate Seminar. Dr. Sunnie S. Chung Dhruv Patel ( ) Kalpesh Sharma ( )

CS542. Algorithms on Secondary Storage Sorting Chapter 13. Professor E. Rundensteiner. Worcester Polytechnic Institute

The Btrfs Filesystem. Chris Mason

Transcription:

Firebird Tour 2017: Performance Vlad Khorsun, Firebird Project

About Firebird Tour 2017 Firebird Tour 2017 is organized by Firebird Project, IBSurgeon and IBPhoenix, and devoted to Firebird Performance. The Platinum sponsor is Moscow Exchange Tour's locations and dates: October 3, 2017 Prague, Czech Republic October 5, 2017 Bad Sassendorf, Germany November 3, 2017 Moscow, Russia

Platinum Sponsor Sponsor of «Firebird 2.5 SQL Language Reference» «Firebird 3.0 SQL Language Reference» «Firebird 3.0 Developer Guide» «Firebird 3.0 Operations Guide» Sponsor of Firebird 2017 Tour seminars www.moex.com

Replication, Recovery and Optimization for Firebird since 2002 Platinum Sponsor of Firebird Foundation Based in Moscow, Russia www.ib-aid.com

Engine internals Performance related changes in FB3 SMP-friendly Super Server Hash Join algorithm Improved nbackup synchronization Reduced number of Pointer Page fetches Delayed Header and\or TIP Page writes for read-only transactions 5

Performance related changes in FB3 ODS12 Primary and Secondary Data Pages Flag Swept for Data and Pointer Pages Allocate and free Data Pages by extents Extent is a group of 8 consecutive pages SCN Pages for physical backup 6

Test machine Benchmarks CPU: Intel i4770, 4/8 cores HDD: 2 SATA drives in RAID 1 (mirror) SSD: Samsung 850 Pro, SATA RAM: 16 GB OS: Windows 7 7

Benchmarks Test database Generated by TPCC load tool Physical parameters 8 KB page size 8.75 GB Forced Writes = ON Restored from the file copy before each test run Table Rows Data Pages CUSTOMER 3`000`000 235`808 DISTRICT 1`000 24 ITEM 100`000 1`520 STOCK 10`000`000 421`528 WAREHOUSE 100 2 8

Read-only, single table Test Query: SELECT COUNT(*) FROM STOCK Page cache 500`000 buffers Caching effect Direct read from disk, not cached by OS nor by Firebird HDD SSD Cached by OS, Firebird cache is empty all reads are from OS cache, no read from physical disk Fully cached by Firebird no reads at all 9

Read-only, single table Test Query: SELECT COUNT(*) FROM STOCK Time, s 50 45 40 35 30 25 20 15 10 5 0 Direct read from disk 43,42 41,87 46,33 39,28 30,68 28,99 HDD, not cached SSD, not cached Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 10

Direct read from disk HDD Read-only, single table Almost identical speed while FB3 is a bit faster than FB 2.5 SSD Due to extents allocation? FB 2.5 slower than on HDD! It requires extra investigation FB 3 30% faster on SSD As expected 11

Read-only, single table Test Query: SELECT COUNT(*) FROM STOCK 6 5,56 No reads from physical disk 5 4 4,01 4,23 4,22 Time, s 3 2 2,57 2,75 1 0 cached by OS cached by FB Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 12

Read-only, single table Firebird 3.0.0 is much slower than Firebird 2.5.8 Minimal cost of page access in Super Server before Firebird 3 is very cheap : just increment and decrement Minimal cost of page access in Super Server in Firebird 3 is much larger : four interlocked operations Firebird 3.0.2 is almost as fast as Firebird 2.5.8 Small internal cache of physical numbers of Data Pages Allows to avoid most accesses of Pointer Pages Reduces number of page accesses (fetches) almost two times 13

Read-only, single table Test Query: SELECT COUNT(*) FROM STOCK 25 000 000 20 000 000 Fetches 20 838 039 20 838 113 Fetches 15 000 000 10 000 000 11 675 220 5 000 000 0 Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 14

Query Read-only, LOOP JOIN PLAN SELECT W.W_NAME, SUM(S.S_QUANTITY), SUM(I.I_PRICE * S.S_QUANTITY) FROM WAREHOUSE W JOIN STOCK S ON W.W_ID = S.S_W_ID JOIN ITEM I ON S.S_I_ID = I.I_ID GROUP BY W.W_NAME SORT (JOIN ( W NATURAL, S INDEX (STOCK_PK), I INDEX (ITEM_PK))) Result set 100 rows 15

Read-only, LOOP JOIN Execution statistics Firebird 2.5.8 Firebird 3.0.2 Firebird 2.5.8 Firebird 3.0.2 Buffers 50 000 50 000 500 000 500 000 Fetches 70 015 390 60 413 829 70 015 390 60 413 828 Reads 10 188 968 10 300 878 0 0 Time 74,99 83,53 35,93 38,55 Per-table statistics Table Indexed Non-indexed ITEM 10 000 000 0 STOCK 10 000 000 0 WAREHOUSE 0 100 16

Read-only, LOOP JOIN Firebird 3 still 7-11% slower than Firebird 2.5 Firebird 3 makes a bit less fetches but not enough less to catch up Firebird 2.5 Table STOCK read all 10M records Using index far not efficient Table ITEMS read all 100K records 100 times! Using index far not efficient Plan and performance is very far from optimal Try to disable index access to avoid LOOP join? 17

Query Read-only, MERGE JOIN SELECT W.W_NAME, SUM(S.S_QUANTITY), SUM(I.I_PRICE * S.S_QUANTITY) FROM WAREHOUSE W JOIN STOCK S ON W.W_ID +0 = S.S_W_ID +0 JOIN ITEM I ON S.S_I_ID = I.I_ID +0 GROUP BY W.W_NAME Plan, Firebird 2.5.8 SORT (MERGE ( SORT (MERGE ( SORT (S NATURAL), SORT (I NATURAL)) ), SORT (W NATURAL)) ) 18

MERGE JOIN algorithm Read-only, MERGE JOIN Requires both input datasources to be sorted on the join columns Sort both inputs Join sorted data within one pass 19

Query Read-only, HASH JOIN SELECT W.W_NAME, SUM(S.S_QUANTITY), SUM(I.I_PRICE * S.S_QUANTITY) FROM WAREHOUSE W JOIN STOCK S ON W.W_ID +0 = S.S_W_ID +0 JOIN ITEM I ON S.S_I_ID = I.I_ID +0 GROUP BY W.W_NAME Plan, Firebird 3.0.2 SORT ( HASH ( HASH (S NATURAL, I NATURAL), W NATURAL ) ) 20

HASH JOIN algorithm Read-only, HASH JOIN Set larger datasource as left input, smaller datasource as right input Build hash table for the right (smaller) datasource Scan left datasource in natural order and probe hash table for matching rows 21

Read-only, MERGE vs HASH Execution statistics Firebird 2.5.8 Firebird 3.0.2 Firebird 2.5.8 Firebird 3.0.2 Buffers 50 000 50 000 500 000 500 000 Fetches 21 040 678 12 027 694 21 040 678 12 027 694 Reads 420 343 423 272 0 0 Time 29,48 23,02 28,27 21,54 Per-table statistics Table Indexed Non-indexed ITEM 0 100 000 STOCK 0 10 000 000 WAREHOUSE 0 100 22

Read-only, MERGE vs HASH Firebird 2.5, MERGE vs LOOP >23 times less reads (420K vs 10M) 3.5 times less fetches (21M vs 70M) Firebird 3, HASH vs LOOP >23 times less reads (423K vs 10M) 5 times less fetches (12M vs 60M) Both versions Much faster Almost independent on Firebird cache size Firebird 3 now >22% faster than Firebird 2.5 23

Read-only, LOOP vs MERGE vs HASH 50`000 buffers Time, s 100 80 60 40 20 74,99 83,53 29,48 23,02 Firebird 2.5.8 Firebird 3.0.2 0 Loop Join Merge\Hash Join 500`000 buffers Time, s 50 40 30 20 10 35,93 38,55 28,27 21,54 Firebird 2.5.8 Firebird 3.0.2 0 Loop Join Merge\Hash Join 24

Read-only, multi-threaded Multi-threaded read-only benchmark Table STOCK have 10'000'000 records 100 warehouses, 100'000 items in each Each reader reads random items in own warehouse We don't test network subsystem client application executes procedure, which selects a number of random items (100 by default) of the same warehouse SELECT * FROM BENCH_1 (:W_ID, 100) We don't test IO subsystem before each test series we ensure whole table STOCK is fully cached by filesystem We do test Firebird scalability 25

Read-only, multi-threaded CREATE OR ALTER PROCEDURE BENCH_1 ( W_ID INTEGER, NUM INTEGER) RETURNS ( I_ID INTEGER) AS DECLARE I1 INTEGER; BEGIN WHILE (NUM > 0) DO BEGIN I1 = RAND() * (100000 1); SELECT S.S_I_ID FROM STOCK S WHERE S.S_W_ID = :W_ID AND S.S_I_ID = :I1 INTO :I_ID; SUSPEND; NUM = NUM 1; END END 26

Read-only, multi-threaded Multi-threaded read-only benchmark Firebird versions 2.5.8 base version for comparison 3.0.0 first release of v3, have some perf problems 3.0.2 current release of v3, have some improvements Super Server default cache size (2 048) medium cache size (50 000) huge cache size (500 000) Classic big cache size (2 048) SuperClassic for Firebird 2.5 Classic mode for Firebird 3 27

Read-only, multi-threaded Different modes within same version 2 500 Exec\sec Firebird 2.5.8 2 000 1 500 1 000 500 0 1 2 4 8 16 32 64 100 SS 2048 SS 50000 SS 500000 SC 2048 Threads 28

Read-only, multi-threaded Different modes within same version 4 000 3 500 3 000 2 500 2 000 1 500 1 000 500 Exec\sec Firebird 3.0.0 0 1 2 4 8 16 32 64 100 Threads SS 2048 SS 50000 SS 500000 CS 2048 29

Read-only, multi-threaded Different modes within same version 4 500 4 000 3 500 3 000 2 500 2 000 1 500 1 000 500 Exec\sec Firebird 3.0.2 0 1 2 4 8 16 32 64 100 Threads SS 2048 SS 50000 SS 500000 CS 2048 30

Read-only, multi-threaded Different versions, same mode 1 600 1 400 1 200 1 000 800 600 400 200 Exec\s Super Server, cache 2048 0 1 2 4 8 16 32 64 100 Threads Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 31

Read-only, multi-threaded Different versions, same mode 2 500 Exec\s Super Server, cache 50000 2 000 1 500 1 000 500 0 1 2 4 8 16 32 64 100 Threads Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 32

Read-only, multi-threaded Different versions, same mode 4 500 4 000 3 500 3 000 2 500 2 000 1 500 1 000 500 Exec\s Super Server, cache 500000 0 1 2 4 8 16 32 64 100 Threads Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 33

Read-only, multi-threaded Different versions, same mode 2 500 Exec\s Classic, cache 2048 2 000 1 500 1 000 500 0 1 2 4 8 16 32 64 100 Threads Firebird 2.5.8 Firebird 3.0.0 Firebird 3.0.2 34

Read-only, multi-threaded Super Classic 2.5.8 scales well up to 8 threads, keeps the performance at 16 threads and then performance drops Classic v3 scales to the almost same level as 2.5.8 but degrades in less degree Super v3 with small and medium cache run a bit worse than Classic v3 Super 3.0.0 with huge cache scales up to 8 threads, then performance drops significantly Super 3.0.2 with huge cache scales well up to 8 threads, slightly adds at 16 threads and then performance drops less than by 4% (for 100 threads) Super 3.0.2 with huge cache works two times faster than Classic 35

TPCC benchmark TPCC database Generated by TPCC load tool 100 warehouses Standard scaling factor Physical parameters 8 KB page size 8.75 GB Forced Writes = ON Restored from the file copy before each test run 36

To be continued full version of presentations from Firebiord Tour 2017 will be published in November 2017 Any questions? ak@ib-aid.com 37