• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Live On Stage
 

Live On Stage

on

  • 3,608 views

Talk about Database staging at #phpday2010

Talk about Database staging at #phpday2010

Statistics

Views

Total Views
3,608
Views on SlideShare
1,300
Embed Views
2,308

Actions

Likes
0
Downloads
0
Comments
0

11 Embeds 2,308

http://www.phpdevblog.net 1777
http://phpdevblog.niknovo.com 429
http://phpdevblog.net 75
http://www.slideshare.net 16
http://translate.googleusercontent.com 4
http://admin.totalmarketing.com 2
http://perevod.yandex.net 1
http://127.0.0.1:8795 1
http://wayback.archive.org 1
http://www.phpdevblog.niknovo.com 1
http://web.archive.org 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Live On Stage Live On Stage Presentation Transcript

  • Live on Stage Dominik Jungowski - May 14, 2010 Live on Stage - Dominik Jungowski
  • Agenda 2 Live on Stage - Dominik Jungowski
  • Agenda ‣ What is Staging? 2 Live on Stage - Dominik Jungowski
  • Agenda ‣ What is Staging? ‣ Reasons for Staging 2 Live on Stage - Dominik Jungowski
  • Agenda ‣ What is Staging? ‣ Reasons for Staging ‣ Implementation 2 Live on Stage - Dominik Jungowski
  • Agenda ‣ What is Staging? ‣ Reasons for Staging ‣ Implementation ‣ Adding a staging layer 2 Live on Stage - Dominik Jungowski
  • Agenda ‣ What is Staging? ‣ Reasons for Staging ‣ Implementation ‣ Adding a staging layer ‣ Problems and Solutions 2 Live on Stage - Dominik Jungowski
  • About me 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old ‣ Employed at CHIP Xonio Online GmbH 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old ‣ Employed at CHIP Xonio Online GmbH ➡ www.chip.de 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old ‣ Employed at CHIP Xonio Online GmbH ➡ www.chip.de ➡ download.chip.eu 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old ‣ Employed at CHIP Xonio Online GmbH ➡ www.chip.de ➡ download.chip.eu ‣ ScrumMaster and Developer at price comparison 3 Live on Stage - Dominik Jungowski
  • About me ‣ 25 years old ‣ Employed at CHIP Xonio Online GmbH ➡ www.chip.de ➡ download.chip.eu ‣ ScrumMaster and Developer at price comparison ‣ Part - time studies in Psychology at distance university FernUni Hagen 3 Live on Stage - Dominik Jungowski
  • What is staging? Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: 5 Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: Databa 5 Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: Databa Website 5 Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: Databa Website 5 Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: Databa Website Admin 5 Live on Stage - Dominik Jungowski
  • What is Staging? Usual Database Design: Databa Website Admin 5 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Website 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Website 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Databa Website 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Databa Website Admin 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Databa Website Admin 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Databa Website Admin 6 Live on Stage - Dominik Jungowski
  • What is Staging? Staging Database Design: Databa Sync Databa Website Admin 6 Live on Stage - Dominik Jungowski
  • Reasons for staging Live on Stage - Dominik Jungowski
  • Reasons for Staging 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security ➡ no sensitive data on live system 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security ➡ no sensitive data on live system ➡ only the essential data is synced 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security ➡ no sensitive data on live system ➡ only the essential data is synced ‣ Quality 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security ➡ no sensitive data on live system ➡ only the essential data is synced ‣ Quality ➡ no changes directly on live system 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Security ➡ no sensitive data on live system ➡ only the essential data is synced ‣ Quality ➡ no changes directly on live system ➡ more time to prevent corruption/errors on live system (user errors, broken imports, etc.) 8 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Performance 9 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Performance ➡ Normalized data on staging database 9 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Performance ➡ Normalized data on staging database ➡ Performance optimized / flat data on live database 9 Live on Stage - Dominik Jungowski
  • Reasons for Staging ‣ Performance ➡ Normalized data on staging database ➡ Performance optimized / flat data on live database ➡ no constraints on live system possible 9 Live on Stage - Dominik Jungowski
  • Implementat ion Live on Stage - Dominik Jungowski
  • Implementation 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for ➡ Changed data 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for ➡ Changed data ➡ Unchanged data 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for ➡ Changed data ➡ Unchanged data ➡ Deleted data on staging, but not on live system 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for ➡ Changed data ➡ Unchanged data ➡ Deleted data on staging, but not on live system ‣ Maybe useful 11 Live on Stage - Dominik Jungowski
  • Implementation ‣ Data is synced ➡ some kind of status flag in staging db is needed ‣ Status needed for ➡ Changed data ➡ Unchanged data ➡ Deleted data on staging, but not on live system ‣ Maybe useful ➡ Deleted on live system 11 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle ne w or ch an ge dd ata Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import No change [0] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import No change [0] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import rem ov ed da ta No change [0] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed [1] ne w or ch an ge dd ata Sync Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed Deleted [1] [2] ne w or ch an ge dd ata Sync Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation The Status - Cycle Changed Deleted [1] [2] ne w or ch an ge dd ata Sync Sync Import rem ov ed da ta No Changed change Deleted [0] [3] 12 Live on Stage - Dominik Jungowski
  • Implementation Why 0, 1, 2, 3? Live on Stage - Dominik Jungowski
  • Implementation Why 0, 1, 2, 3? Let‘s take a look at the binary numbers! Live on Stage - Dominik Jungowski
  • Implementation 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 0010 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 0010 Changed Deleted [3] 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 0010 Changed Deleted [3] = 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 0010 Changed Deleted [3] = 0011 14 Live on Stage - Dominik Jungowski
  • Implementation No change [0] = 0000 Changed [1] = 0001 Deleted [2] = 0010 Changed Deleted [3] = 0011 = 0001 | 0010 14 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP class phpDay_Sync { /** * Status for changed data * Binary: 0001 */ const STATUS_CHANGED = 1; /** * Status for removed data * Binary: 0010 */ const STATUS_DELETED = 2; ... } 15 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; // Speaker has been synced to live system 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; // Speaker has been synced to live system $speaker[‘status‘] = 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; // Speaker has been synced to live system $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED & phpDay_Sync::STATUS_DELETED); 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; // Speaker has been synced to live system $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED & phpDay_Sync::STATUS_DELETED); //... or easier :-) 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker status has changed $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGED; // Speaker has been synced to live system $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED & phpDay_Sync::STATUS_DELETED); //... or easier :-) $speaker[‘status‘] = 0; 16 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file // 0001 | 0010 = 0011 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file // 0001 | 0010 = 0011 $speaker[‘status‘] = 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file // 0001 | 0010 = 0011 $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED | phpDay_Sync::STATUS_DELETED); 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file // 0001 | 0010 = 0011 $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED | phpDay_Sync::STATUS_DELETED); // Speaker has been deleted on live system 17 Live on Stage - Dominik Jungowski
  • Implementation Using the binary flags in PHP // Speaker didn‘t show up in import file // 0001 | 0010 = 0011 $speaker[‘status‘] = (phpDay_Sync::STATUS_CHANGED | phpDay_Sync::STATUS_DELETED); // Speaker has been deleted on live system $speaker[‘status‘] = phpDay_Sync::STATUS_DELETED; 17 Live on Stage - Dominik Jungowski
  • Binary AND & 0 1 2 3 0 0 0 0 1 0 0 1 2 0 0 2 3 0 1 2 18 Live on Stage - Dominik Jungowski
  • Binary AND & 0 1 2 3 0000 0000 0000 0 & 0001 & 0010 & 0011 = 0000 = 0000 = 0000 0001 0001 0001 1 & 0000 & 0010 & 0011 = 0000 = 0000 = 0001 0010 0010 0010 2 & 0000 & 0001 & 0011 = 0000 = 0000 = 0010 0011 0011 0010 3 & 0000 & 0001 & 0011 = 0000 = 0001 = 0010 19 Live on Stage - Dominik Jungowski
  • Binary OR | 0 1 2 3 0 1 2 3 1 1 3 3 2 2 3 3 3 3 3 3 20 Live on Stage - Dominik Jungowski
  • Binary OR | 0 1 2 3 0000 0000 0000 0 | 0001 | 0010 | 0011 = 0001 = 0010 = 0011 0001 0001 0001 1 | 0000 | 0010 | 0011 = 0001 = 0011 = 0011 0010 0001 0010 2 | 0000 | 0010 | 0011 = 0010 = 0011 = 0011 0011 0011 0011 3 | 0000 | 0001 | 0010 = 0010 = 0011 = 0011 21 Live on Stage - Dominik Jungowski
  • Deleting on live system Status 3 Status 2 Live on Stage - Dominik Jungowski
  • Implementation & 0 1 2 3 0 0 0 0 1 0 0 1 2 0 0 2 3 0 1 2 23 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $speaker[‘status‘] = 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $speaker[‘status‘] = ($speaker[‘status‘] & phpDay_Sync::STATUS_DELETED); 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $speaker[‘status‘] = ($speaker[‘status‘] & phpDay_Sync::STATUS_DELETED); // or if you know you will never use more than those 4 status flags: 24 Live on Stage - Dominik Jungowski
  • Implementation ... in PHP // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $speaker[‘status‘] = ($speaker[‘status‘] & phpDay_Sync::STATUS_DELETED); // or if you know you will never use more than those 4 status flags: $speaker[‘status‘] = phpDay_Sync::STATUS_CHANGEDELETED; 24 Live on Stage - Dominik Jungowski
  • Implementation ... in MySQL 25 Live on Stage - Dominik Jungowski
  • Implementation ... in MySQL // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $sql = ‘UPDATE speaker SET status = status & ‘ . phpDay_Sync::STATUS_DELETED; 25 Live on Stage - Dominik Jungowski
  • Implementation ... in MySQL // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $sql = ‘UPDATE speaker SET status = status & ‘ . phpDay_Sync::STATUS_DELETED; ‣ But: Rather slow in MySQL 25 Live on Stage - Dominik Jungowski
  • Implementation ... in MySQL // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $sql = ‘UPDATE speaker SET status = status & ‘ . phpDay_Sync::STATUS_DELETED; ‣ But: Rather slow in MySQL // We‘ve synced the deleted speaker, status 3 => status 2 // 0011 & 0010 = 0010 $status = $speaker->getStatus(); $sql = ‘UPDATE speaker SET status = ‘ . ($status & phpDay_Sync::STATUS_DELETED); 25 Live on Stage - Dominik Jungowski
  • Adding a staging layer Things to consider Live on Stage - Dominik Jungowski
  • Adding a staging layer 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers ➡ Data you need on live system 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers ➡ Data you need on live system ➡ Data you need on staging system 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers ➡ Data you need on live system ➡ Data you need on staging system ➡ Data you need on both systems 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers ➡ Data you need on live system ➡ Data you need on staging system ➡ Data you need on both systems ‣ Write down all the cronjobs 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Distribution of cronjobs: 1 server ➝ 2 servers ➡ Data you need on live system ➡ Data you need on staging system ➡ Data you need on both systems ‣ Write down all the cronjobs ‣ Decide where you need them 27 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Database server 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database server 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database server New (synced) database 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database Website server New (synced) database 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database Website server New (synced) database 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database Website server New (synced) database 28 Live on Stage - Dominik Jungowski
  • Adding a staging layer ‣ Switching live system Old database Database Website server New (synced) database 28 Live on Stage - Dominik Jungowski
  • Problems & Solutions 29 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for User Sync St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for User Sync St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for User Sync Status: 1 St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync User Sync finished Status: 1 St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync User Sync finished Status: 1 St at us :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Problem: Data integrity Read for Sync User Sync finished 0 Status: 1 St s: at u at us St :1 Status flag 30 Live on Stage - Dominik Jungowski
  • Problems & Solutions 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking mysql> LOCK TABLES speaker WRITE; 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking mysql> LOCK TABLES speaker WRITE; ‣ Problem: Whole table is locked for reading and writing 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking mysql> LOCK TABLES speaker WRITE; ‣ Problem: Whole table is locked for reading and writing mysql> SELECT * FROM speaker WHERE status = 1 FOR UPDATE; 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking mysql> LOCK TABLES speaker WRITE; ‣ Problem: Whole table is locked for reading and writing mysql> SELECT * FROM speaker WHERE status = 1 FOR UPDATE; ‣ Only locks the selected rows 31 Live on Stage - Dominik Jungowski
  • Problems & Solutions ‣ Solution: Table locking mysql> LOCK TABLES speaker WRITE; ‣ Problem: Whole table is locked for reading and writing mysql> SELECT * FROM speaker WHERE status = 1 FOR UPDATE; ‣ Only locks the selected rows ‣ Reading other data from table is still possible 31 Live on Stage - Dominik Jungowski
  • Contact me ‣ Weblog: www.phpdevblog.net ‣ Twitter: www.twitter.com/djungowski ‣ Xing: http://www.xing.com/profile/ Dominik_Jungowski 32 Live on Stage - Dominik Jungowski
  • Questions? 33 Live on Stage - Dominik Jungowski
  • Thank you! 34 Live on Stage - Dominik Jungowski