SlideShare a Scribd company logo
Logically Sharding a Growing
PostgreSQL Database
The Breakup
Introductions
Students hate us.
Introductions
Turnitin.com
Samantha: database
@mzsamantha
Fred: code
@phredmoyer
The Seven Stages Of Grief Scaling
1. Shock and Denial
2. Pain and Guilt
3. Anger and
Bargaining
4. Depression &
Reflection
5. The Upward Turn
6. Reconstruction
7. Acceptance and
Hope
The Seven Stages Of Grief Scaling
1. Shock and Denial
2. Pain and Guilt
3. Anger and
Bargaining
4. Depression &
Reflection
5. The Upward Turn
6. Reconstruction
7. Acceptance and
Hope
1. Monolithic Scaling
2. Hardware is
Expensive
3. If We Do It This
Way...
4. We Are So *%@#!&
5. Down To 150 Bugs!
6. Release Day
7. Beer & Therapy
(beerapy?)
The Problem
● The ability to efficiently backup and restore
● The amount of ram required to keep indexes
in memory
● Resource contention causing query planner
to make sub-optimal choices.
● Aged data extending query resources and
execution time
● Overlap in existing ID spaces
● No account crossover between shards. I.E.
Tii-UK and Tii require separate accounts.
Stage 2: Options
● Account based sharding
o Difficult to split account usage evenly across shards.
● Geographical based sharding
o Currently have one geographical shard (UK).
o Added deployment, poor resource utilization.
● Oracle RAC ($$$)
o Oracle OpenWorld is Sunday in SF. No bacon there.
● Horizontal sharding
o Move fast growing tables to separate physical hosts.
o Break relational constraints.
o Good path to a service oriented architecture node.
Stage 2: Options
Why Did We Discuss All That Before Phase 1?
Stage 2: Options
Objective Expertise.
Please Step Away From the Application.
Triage
What is going to kill us first?
Stage 1: DiagnoseTablesizeinGigs
Stage 1: Diagnose
Database size: 507 GB
m_object_paper: 94 GB
gm3_mark: 71 GB
m_object: 53 GB
m_report_stats: 35 GB
Four tables account for half the
bulk of the entire database.
Stage 1: Diagnose
What About Table
Sharding?
Stage 2: Options
Three Part Two Year Proposal: Short, Mid, and
Long term Goals.
Short: 3 Months
Query Partition and Refactor
Removal of ‘Leaf Service’: Marks
Stage 2: Options
Three Part Two Year Proposal: Short, Mid, and
Long term Goals.
Mid: 9 Months
ID Reconciliation Between Shards
Table Partitioning
Stage 2: Options
Three Part Two Year Proposal: Short, Mid, and
Long term Goals.
Long: 12 Months
Create DAL
Removal of Large Tables
Global Statistics and Reporting
Stage 2: Options
Short Term: 12 Months Later
I do not think it means what you think it
means.
Stage 3: Scoping The Solution - Database
Main
Marks
Stage 3: Scoping The Solution - Database
Data Up Approach:
Start with the schema
Isolate direct links
Slow, Tedious, and Painful
Stage 3: Scoping The Solution - Database
Foreign-key constraints:
"$1" FOREIGN KEY (source) REFERENCES m_object(id)
"$2" FOREIGN KEY (reader) REFERENCES m_user(id)
"m_dg_read_pm_review_set_fkey" FOREIGN KEY (pm_review_set) REFERENCES pm_review_set(id)
Referenced by:
TABLE "gm_mark" CONSTRAINT "$1" FOREIGN KEY (read) REFERENCES m_dg_read(id)
TABLE "erater_read_filter" CONSTRAINT "erater_read_filter_read_fkey" FOREIGN KEY (read) REFERENCES
m_dg_read(id) ON DELETE CASCADE
TABLE "gm3_mark" CONSTRAINT "gm3_mark_read_fkey" FOREIGN KEY (read) REFERENCES
m_dg_read(id) ON DELETE CASCADE
TABLE "gm3_rubric_scoring" CONSTRAINT "gm3_rubric_scoring_read_fkey" FOREIGN KEY (read)
REFERENCES m_dg_read(id)
TABLE "r_mark_criterion" CONSTRAINT "mark_criterion_read_fkey" FOREIGN KEY (read) REFERENCES
m_dg_read(id) ON DELETE CASCADE
TABLE "pm_review" CONSTRAINT "pm_review_id_fkey" FOREIGN KEY (id) REFERENCES m_dg_read(id)
TABLE "r_read_audio" CONSTRAINT "r_read_audio_read_id_fkey" FOREIGN KEY (read_id) REFERENCES
m_dg_read(id)
Stage 3: Scoping The Solution - Database
Original: 236 tables
New main database (192 tables)
New marks database (40 tables)
Stage 3: Scoping The Solution - Code
Option 1 - Data Access Layer (DAL)
o Separate codebase encapsulating new set of tables
o Written in Golang, an HTTP based REST service
o Avoids carrying forward existing technical debt
o Requires detailed knowledge of existing product features
o Unit tests are very helpful, but coverage is never 100%
o 14 years of business logic (dark matter)
o In long lived web apps, tribal knowledge is authoritative
Stage 3: Scoping The Solution - Code
Option 2 - Add additional database handles to new db
o Perceived as a safer approach (deciding factor,
known risks).
o Requires paying interest on existing technical debt.
o Refactoring is less risky than rewriting.
o Take advantage of existing business logic and tribal
knowledge.
o Preserve sacred cows.
Stage 3: Scoping The Solution -
Hardware
"We can use smaller hardware because we are
splitting off part of the database"
➢This is somewhat of a fallacy
➢You might need smaller storage
➢You might need slightly less CPU
➢Stick with close to the same amount of RAM
Stage 4: Implementation - Rollback
S: “What if this fails?”
F: “We Rollback the code, restore the database,
and look for new jobs.”
Stage 4: Implementation - Rollback
Q: How do you bifurcate a database and
rollback without data loss?
A: Slony.
Stage 4: Implementation - Rollback
Timelines matter. Prepare in advance.
Split Replication Well In Advance.
Test Process, Then Test It Again.
Stage 4: Implementation - Archaeology
● What is this table? That service doesn’t exist
anymore?
○ Let’s Drop it!
●What’s that table? It’s an old version still in
use?
○ Let’s Drop it!
●What’s that one over there?
○ Let’s Drop it!
Stage 4: Implementation - Archaeology
Wait… old version still in use?
Stage 4: Implementation - Archaeology
● Fourteen years of application development.
● Five major codebases, dozens of support utilities.
● Hundreds of codepoints for database connections.
● A dozen different ORMs.
● Dynamically generated SQL joining tables.
● Technical debt (code with high maintenance costs).
● Best practices of 10 years ago are now liabilities.
How do you change all of
the electrical sockets in an
(old) office building?
Stage 4: Implementation - Archaeology
Stage 4: Implementation - Archaeology
EMPATHY
Stage 4: Implementation - Archaeology
EMPATHY
put yourself in the mind of the
author
Stage 4: Implementation - Archaeology
James left 8 years ago. The elevator is in old building.
They tore down the old building to build a Target.
# this code is critical to our workflow, don’t remove it!!
# for details talk to jamesb <> who sits near the elevator
# $foo = $object->flocculate( key => $cfg->secret_key );
# return $foo;
return;
Stage 4: Implementation - Archaeology
Bob is still here though. Bob is a little particular
about his code though (we are all to some degree).
Now you’re in there meddling with Bob’s code. How
would you feel if you were Bob?
A little empathy goes a long way towards getting Bob
to help you get his code ported to the new dual
database schema.
Stage 4: Implementation - Queries
main database - marks database
SELECT count(m.*) FROM
gm3_mark m, gm3_qm_template qmt
WHERE m.read IN
(SELECT dgr.id FROM m_dg_read dgr
JOIN m_object_paper mop ON (mop.id =
dgr.source AND mop.owner = ?)
JOIN m_assignment ma ON (ma.id =
mop.assignment AND ma.class = ?) WHERE
reader = ?)
AND m.qm_template = qmt.id AND qmt.id = ?
Main Database - grab ids to pass to marks database.
SELECT p.id
FROM m_object_paper p
JOIN m_assignment a
ON a.id = p.assignment
WHERE a.class = ?
AND p.owner = ?
Stage 4: Implementation - Queries
Stage 4: Implementation - Queries
Marks database - pass former FK ids to an IN clause.
SELECT count(m.*)
FROM gm3_mark m
JOIN gm3_qm_template qmt
ON qmt.id = m.qm_template
JOIN m_dg_read dgr
ON dgr.id = m.read
WHERE dgr.source IN (?, ?, ?)
AND qmt.id = ? AND dgr.reader = ?
Stage 4: Implementation - Transactions
Single database transactions are easy.
eval {
$db->do(“INSERT INTO foo (name) VALUES
(‘bar’)”);
$id = $db->do(“SELECT CURRVAL(‘foo’)”);
$db->do(“INSERT INTO fee (foo_id) VALUES
($id)”);
};
if ($@) { # catch exception
$db->rollback; # roll transaction back
} else {
$db->commit; # commit transaction
}
Stage 4: Implementation - Transactions
Dual database transactions are harder.
eval {
# insert into foo in main db, grab last value
$main_db->do(“INSERT INTO foo VALUES (‘bar’)”);
$foo_id = $main_db->do(“SELECT CURRVAL(‘foo’)”);
# insert foo id into marks db, grab last value
$marks_db->do(“INSERT INTO fee VALUES ($id)”);
$fee_id = $main_db->do(“SELECT CURRVAL(‘fee’)”);
};
Stage 4: Implementation - Transactions
Roll back both handles on exception, commit both on
success.
if ($@) { # catch exception
$main_db->rollback; # roll main_db back
$marks_db->rollback; # roll marks_db back
} else {
$main_db->commit; # commit main_db
$marks_db->commit; # commit marks_db
}
Stage 4: Implementation - Transactions
What if the commit fails?
if ($@) { # catch exception
$main_db->rollback; # roll main_db back
$marks_db->rollback; # roll marks_db back
} else {
eval { $main_db->commit };
if ($@) {
$main_db->rollback;
$marks_db->rollback;
}
eval { $marks_db->commit }; ...
Stage 4: Implementation - Transactions
CAP (Brewer’s Law)
Stage 4: Implementation - Transactions
Consistency or
Availability?
Stage 4: Implementation - Transactions
9 out of 10 users
prefer availability
So does customer support.
You can fix consistency.
Stage 4: Implementation - ORMs
ORMs are full of pain
● They hide away db connection details.
● They make it hard to break models apart.
● They make writing code easy…
● But debugging is much more difficult.
Stage 4: Implementation - ORMs
ORMs are full of pain
Back in my day we used SQL, and we liked it.
$classes = $c->classes->search( $select_hash, {
'+select' => 'source.id',
'+as' => 'src_id',
'join' => [ { 'user_rights_class' =>
{ 'user_role' => 'owner' } }, 'source' ],
'rows' => 200,
'page' => 1
} );
Stage 4: Implementation - Juggling
Talking to two databases
is easy, right?
Stage 4: Implementation - Juggling
Talking to two databases
is easy, right?
Not as easy as it seems.
Stage 4: Implementation - Juggling
Main database - Marks database
Are you talking to me?
Stage 4: Implementation - Juggling
Main database - Marks database
I think he was talking to me.
Stage 4: Implementation - Config
● Main Database: One master, two slaves (2)
● Marks Database: One master, two slaves (2)
● ASP application: write user, read only user (2)
● Catalyst Application: write user, read only user (2)
● REST Application: write user, read only user (2)
● dev, qa, staging, production, sandbox, uk (6)
Stage 4: Implementation - Config
● Database hosts and users: 2*5 = 10
● Stages: 10 * 6 = 60
● Config managed in version control, no discovery.
● Config deployed via RPM with application.
● Get one wrong? Start all over again.
● Configuration is full of pain and suffering.
Stage 4: Implementation - Config
Yes, we are moving to Chef.
Stage 4: Implementation - Tech Debt
How much tech debt
do you have?
Stage 4: Implementation - Tech Debt
How much tech debt
do you have?
More than you think.
Stage 4: Implementation - Tech Debt
How much of it will you
have to deal with?
Stage 4: Implementation - Tech Debt
How much of it will you
have to deal with?
More than you think.
Stage 4: Implementation - Tech Debt
Our legacy app:
● 5 ORMs
● No unit tests (many integration tests)
● Two template frameworks
● 9 different log files
● Code is generally pretty readable!
Stage 4: Implementation - Tech Debt
Stage 5: Release
Planned 8 hour Maintenance Window
15 People + support
2.5 Hours Main Service
1.5 Hours UK
2 Hours Sandbox + Cat Videos
Stage 5: Release
Stage 6: Cleanup
Patch Flavors:
How Did That Get there?
That’s a bug.
It worked fine in dev.
Stage 6: Cleanup
“Sometimes the query planner does dumb things”
o People forget why you embarked on this effort.
o People forget the successes and risk mitigation.
o People won’t forget the visceral reactions to
service degradations.
Stage 6: Cleanup
How to bring your site to a halt:
1.Start transaction to database 1
2.Start transaction to database 2
3.Wait for database 1 to finish
Stage 6: Cleanup
PANIC
Stage 6: Cleanup
Gone in 60 seconds
Stage 6: Cleanup
Stage 6: Cleanup
Where Do We Golang From here?
Back To Plan A.
Most of the heavy lifting is done.
“The first split is the hardest” - Some Guy Here
The End
So long SurgeCon!
And thanks for the bacon.

More Related Content

Similar to The Breakup - Logically Sharding a Growing PostgreSQL Database

Data herding
Data herdingData herding
Data herding
unbracketed
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDB
Fitz Agard
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)
MongoSF
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
Mike Harris
 
Scaling your website
Scaling your websiteScaling your website
Scaling your website
Alejandro Marcu
 
TDD with PhpSpec
TDD with PhpSpecTDD with PhpSpec
TDD with PhpSpec
CiaranMcNulty
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
Hyderabad Scalability Meetup
 
The Essential Perl Hacker's Toolkit
The Essential Perl Hacker's ToolkitThe Essential Perl Hacker's Toolkit
The Essential Perl Hacker's Toolkit
Stephen Scaffidi
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
Katie Gulley
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
System Design.pdf
System Design.pdfSystem Design.pdf
System Design.pdf
JitendraYadav351971
 
Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Edition
ddiers
 
Designing code
Designing codeDesigning code
Designing code
Steve Smith
 
ETL and pivoting in spark
ETL and pivoting in sparkETL and pivoting in spark
ETL and pivoting in spark
Subhasish Guha
 
ETL and pivoting in spark
ETL and pivoting in sparkETL and pivoting in spark
ETL and pivoting in spark
Subhasish Guha
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
Jonathan Felch
 
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Michael Rosenblum
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
Vitali Pekelis
 
Wide Search Molecular Replacement and the NEBioGrid portal interface
Wide Search Molecular Replacement and the NEBioGrid portal interfaceWide Search Molecular Replacement and the NEBioGrid portal interface
Wide Search Molecular Replacement and the NEBioGrid portal interface
Boston Consulting Group
 

Similar to The Breakup - Logically Sharding a Growing PostgreSQL Database (20)

Data herding
Data herdingData herding
Data herding
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDB
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Scaling your website
Scaling your websiteScaling your website
Scaling your website
 
TDD with PhpSpec
TDD with PhpSpecTDD with PhpSpec
TDD with PhpSpec
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
 
The Essential Perl Hacker's Toolkit
The Essential Perl Hacker's ToolkitThe Essential Perl Hacker's Toolkit
The Essential Perl Hacker's Toolkit
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
System Design.pdf
System Design.pdfSystem Design.pdf
System Design.pdf
 
Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Edition
 
Designing code
Designing codeDesigning code
Designing code
 
ETL and pivoting in spark
ETL and pivoting in sparkETL and pivoting in spark
ETL and pivoting in spark
 
ETL and pivoting in spark
ETL and pivoting in sparkETL and pivoting in spark
ETL and pivoting in spark
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
 
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
 
Wide Search Molecular Replacement and the NEBioGrid portal interface
Wide Search Molecular Replacement and the NEBioGrid portal interfaceWide Search Molecular Replacement and the NEBioGrid portal interface
Wide Search Molecular Replacement and the NEBioGrid portal interface
 

More from Fred Moyer

Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+
Fred Moyer
 
Practical service level objectives with error budgeting
Practical service level objectives with error budgetingPractical service level objectives with error budgeting
Practical service level objectives with error budgeting
Fred Moyer
 
SREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightSREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done Right
Fred Moyer
 
Scale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done RightScale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done Right
Fred Moyer
 
Latency SLOs Done Right
Latency SLOs Done RightLatency SLOs Done Right
Latency SLOs Done Right
Fred Moyer
 
Latency SLOs done right
Latency SLOs done rightLatency SLOs done right
Latency SLOs done right
Fred Moyer
 
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and IstioComprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
Fred Moyer
 
Comprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioComprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istio
Fred Moyer
 
Effective management of high volume numeric data with histograms
Effective management of high volume numeric data with histogramsEffective management of high volume numeric data with histograms
Effective management of high volume numeric data with histograms
Fred Moyer
 
Statistics for dummies
Statistics for dummiesStatistics for dummies
Statistics for dummies
Fred Moyer
 
GrafanaCon EU 2018
GrafanaCon EU 2018GrafanaCon EU 2018
GrafanaCon EU 2018
Fred Moyer
 
Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017
Fred Moyer
 
Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016
Fred Moyer
 
Better service monitoring through histograms
Better service monitoring through histogramsBetter service monitoring through histograms
Better service monitoring through histograms
Fred Moyer
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmers
Fred Moyer
 
Surge 2012 fred_moyer_lightning
Surge 2012 fred_moyer_lightningSurge 2012 fred_moyer_lightning
Surge 2012 fred_moyer_lightning
Fred Moyer
 
Qpsmtpd
QpsmtpdQpsmtpd
Qpsmtpd
Fred Moyer
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
Fred Moyer
 
Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008
Fred Moyer
 
Data::FormValidator Simplified
Data::FormValidator SimplifiedData::FormValidator Simplified
Data::FormValidator Simplified
Fred Moyer
 

More from Fred Moyer (20)

Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+
 
Practical service level objectives with error budgeting
Practical service level objectives with error budgetingPractical service level objectives with error budgeting
Practical service level objectives with error budgeting
 
SREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightSREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done Right
 
Scale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done RightScale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done Right
 
Latency SLOs Done Right
Latency SLOs Done RightLatency SLOs Done Right
Latency SLOs Done Right
 
Latency SLOs done right
Latency SLOs done rightLatency SLOs done right
Latency SLOs done right
 
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and IstioComprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
 
Comprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioComprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istio
 
Effective management of high volume numeric data with histograms
Effective management of high volume numeric data with histogramsEffective management of high volume numeric data with histograms
Effective management of high volume numeric data with histograms
 
Statistics for dummies
Statistics for dummiesStatistics for dummies
Statistics for dummies
 
GrafanaCon EU 2018
GrafanaCon EU 2018GrafanaCon EU 2018
GrafanaCon EU 2018
 
Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017
 
Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016
 
Better service monitoring through histograms
Better service monitoring through histogramsBetter service monitoring through histograms
Better service monitoring through histograms
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmers
 
Surge 2012 fred_moyer_lightning
Surge 2012 fred_moyer_lightningSurge 2012 fred_moyer_lightning
Surge 2012 fred_moyer_lightning
 
Qpsmtpd
QpsmtpdQpsmtpd
Qpsmtpd
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
 
Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008
 
Data::FormValidator Simplified
Data::FormValidator SimplifiedData::FormValidator Simplified
Data::FormValidator Simplified
 

Recently uploaded

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 

Recently uploaded (20)

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 

The Breakup - Logically Sharding a Growing PostgreSQL Database

  • 1. Logically Sharding a Growing PostgreSQL Database The Breakup
  • 4. The Seven Stages Of Grief Scaling 1. Shock and Denial 2. Pain and Guilt 3. Anger and Bargaining 4. Depression & Reflection 5. The Upward Turn 6. Reconstruction 7. Acceptance and Hope
  • 5. The Seven Stages Of Grief Scaling 1. Shock and Denial 2. Pain and Guilt 3. Anger and Bargaining 4. Depression & Reflection 5. The Upward Turn 6. Reconstruction 7. Acceptance and Hope 1. Monolithic Scaling 2. Hardware is Expensive 3. If We Do It This Way... 4. We Are So *%@#!& 5. Down To 150 Bugs! 6. Release Day 7. Beer & Therapy (beerapy?)
  • 6. The Problem ● The ability to efficiently backup and restore ● The amount of ram required to keep indexes in memory ● Resource contention causing query planner to make sub-optimal choices. ● Aged data extending query resources and execution time ● Overlap in existing ID spaces ● No account crossover between shards. I.E. Tii-UK and Tii require separate accounts.
  • 7. Stage 2: Options ● Account based sharding o Difficult to split account usage evenly across shards. ● Geographical based sharding o Currently have one geographical shard (UK). o Added deployment, poor resource utilization. ● Oracle RAC ($$$) o Oracle OpenWorld is Sunday in SF. No bacon there. ● Horizontal sharding o Move fast growing tables to separate physical hosts. o Break relational constraints. o Good path to a service oriented architecture node.
  • 8. Stage 2: Options Why Did We Discuss All That Before Phase 1?
  • 9. Stage 2: Options Objective Expertise. Please Step Away From the Application.
  • 10. Triage What is going to kill us first?
  • 12. Stage 1: Diagnose Database size: 507 GB m_object_paper: 94 GB gm3_mark: 71 GB m_object: 53 GB m_report_stats: 35 GB Four tables account for half the bulk of the entire database.
  • 13. Stage 1: Diagnose What About Table Sharding?
  • 14. Stage 2: Options Three Part Two Year Proposal: Short, Mid, and Long term Goals. Short: 3 Months Query Partition and Refactor Removal of ‘Leaf Service’: Marks
  • 15. Stage 2: Options Three Part Two Year Proposal: Short, Mid, and Long term Goals. Mid: 9 Months ID Reconciliation Between Shards Table Partitioning
  • 16. Stage 2: Options Three Part Two Year Proposal: Short, Mid, and Long term Goals. Long: 12 Months Create DAL Removal of Large Tables Global Statistics and Reporting
  • 17. Stage 2: Options Short Term: 12 Months Later I do not think it means what you think it means.
  • 18. Stage 3: Scoping The Solution - Database Main Marks
  • 19. Stage 3: Scoping The Solution - Database Data Up Approach: Start with the schema Isolate direct links Slow, Tedious, and Painful
  • 20. Stage 3: Scoping The Solution - Database Foreign-key constraints: "$1" FOREIGN KEY (source) REFERENCES m_object(id) "$2" FOREIGN KEY (reader) REFERENCES m_user(id) "m_dg_read_pm_review_set_fkey" FOREIGN KEY (pm_review_set) REFERENCES pm_review_set(id) Referenced by: TABLE "gm_mark" CONSTRAINT "$1" FOREIGN KEY (read) REFERENCES m_dg_read(id) TABLE "erater_read_filter" CONSTRAINT "erater_read_filter_read_fkey" FOREIGN KEY (read) REFERENCES m_dg_read(id) ON DELETE CASCADE TABLE "gm3_mark" CONSTRAINT "gm3_mark_read_fkey" FOREIGN KEY (read) REFERENCES m_dg_read(id) ON DELETE CASCADE TABLE "gm3_rubric_scoring" CONSTRAINT "gm3_rubric_scoring_read_fkey" FOREIGN KEY (read) REFERENCES m_dg_read(id) TABLE "r_mark_criterion" CONSTRAINT "mark_criterion_read_fkey" FOREIGN KEY (read) REFERENCES m_dg_read(id) ON DELETE CASCADE TABLE "pm_review" CONSTRAINT "pm_review_id_fkey" FOREIGN KEY (id) REFERENCES m_dg_read(id) TABLE "r_read_audio" CONSTRAINT "r_read_audio_read_id_fkey" FOREIGN KEY (read_id) REFERENCES m_dg_read(id)
  • 21. Stage 3: Scoping The Solution - Database Original: 236 tables New main database (192 tables) New marks database (40 tables)
  • 22. Stage 3: Scoping The Solution - Code Option 1 - Data Access Layer (DAL) o Separate codebase encapsulating new set of tables o Written in Golang, an HTTP based REST service o Avoids carrying forward existing technical debt o Requires detailed knowledge of existing product features o Unit tests are very helpful, but coverage is never 100% o 14 years of business logic (dark matter) o In long lived web apps, tribal knowledge is authoritative
  • 23. Stage 3: Scoping The Solution - Code Option 2 - Add additional database handles to new db o Perceived as a safer approach (deciding factor, known risks). o Requires paying interest on existing technical debt. o Refactoring is less risky than rewriting. o Take advantage of existing business logic and tribal knowledge. o Preserve sacred cows.
  • 24. Stage 3: Scoping The Solution - Hardware "We can use smaller hardware because we are splitting off part of the database" ➢This is somewhat of a fallacy ➢You might need smaller storage ➢You might need slightly less CPU ➢Stick with close to the same amount of RAM
  • 25. Stage 4: Implementation - Rollback S: “What if this fails?” F: “We Rollback the code, restore the database, and look for new jobs.”
  • 26. Stage 4: Implementation - Rollback Q: How do you bifurcate a database and rollback without data loss? A: Slony.
  • 27. Stage 4: Implementation - Rollback Timelines matter. Prepare in advance. Split Replication Well In Advance. Test Process, Then Test It Again.
  • 28. Stage 4: Implementation - Archaeology ● What is this table? That service doesn’t exist anymore? ○ Let’s Drop it! ●What’s that table? It’s an old version still in use? ○ Let’s Drop it! ●What’s that one over there? ○ Let’s Drop it!
  • 29. Stage 4: Implementation - Archaeology Wait… old version still in use?
  • 30. Stage 4: Implementation - Archaeology ● Fourteen years of application development. ● Five major codebases, dozens of support utilities. ● Hundreds of codepoints for database connections. ● A dozen different ORMs. ● Dynamically generated SQL joining tables. ● Technical debt (code with high maintenance costs). ● Best practices of 10 years ago are now liabilities.
  • 31. How do you change all of the electrical sockets in an (old) office building? Stage 4: Implementation - Archaeology
  • 32. Stage 4: Implementation - Archaeology EMPATHY
  • 33. Stage 4: Implementation - Archaeology EMPATHY put yourself in the mind of the author
  • 34. Stage 4: Implementation - Archaeology James left 8 years ago. The elevator is in old building. They tore down the old building to build a Target. # this code is critical to our workflow, don’t remove it!! # for details talk to jamesb <> who sits near the elevator # $foo = $object->flocculate( key => $cfg->secret_key ); # return $foo; return;
  • 35. Stage 4: Implementation - Archaeology Bob is still here though. Bob is a little particular about his code though (we are all to some degree). Now you’re in there meddling with Bob’s code. How would you feel if you were Bob? A little empathy goes a long way towards getting Bob to help you get his code ported to the new dual database schema.
  • 36. Stage 4: Implementation - Queries main database - marks database SELECT count(m.*) FROM gm3_mark m, gm3_qm_template qmt WHERE m.read IN (SELECT dgr.id FROM m_dg_read dgr JOIN m_object_paper mop ON (mop.id = dgr.source AND mop.owner = ?) JOIN m_assignment ma ON (ma.id = mop.assignment AND ma.class = ?) WHERE reader = ?) AND m.qm_template = qmt.id AND qmt.id = ?
  • 37. Main Database - grab ids to pass to marks database. SELECT p.id FROM m_object_paper p JOIN m_assignment a ON a.id = p.assignment WHERE a.class = ? AND p.owner = ? Stage 4: Implementation - Queries
  • 38. Stage 4: Implementation - Queries Marks database - pass former FK ids to an IN clause. SELECT count(m.*) FROM gm3_mark m JOIN gm3_qm_template qmt ON qmt.id = m.qm_template JOIN m_dg_read dgr ON dgr.id = m.read WHERE dgr.source IN (?, ?, ?) AND qmt.id = ? AND dgr.reader = ?
  • 39. Stage 4: Implementation - Transactions Single database transactions are easy. eval { $db->do(“INSERT INTO foo (name) VALUES (‘bar’)”); $id = $db->do(“SELECT CURRVAL(‘foo’)”); $db->do(“INSERT INTO fee (foo_id) VALUES ($id)”); }; if ($@) { # catch exception $db->rollback; # roll transaction back } else { $db->commit; # commit transaction }
  • 40. Stage 4: Implementation - Transactions Dual database transactions are harder. eval { # insert into foo in main db, grab last value $main_db->do(“INSERT INTO foo VALUES (‘bar’)”); $foo_id = $main_db->do(“SELECT CURRVAL(‘foo’)”); # insert foo id into marks db, grab last value $marks_db->do(“INSERT INTO fee VALUES ($id)”); $fee_id = $main_db->do(“SELECT CURRVAL(‘fee’)”); };
  • 41. Stage 4: Implementation - Transactions Roll back both handles on exception, commit both on success. if ($@) { # catch exception $main_db->rollback; # roll main_db back $marks_db->rollback; # roll marks_db back } else { $main_db->commit; # commit main_db $marks_db->commit; # commit marks_db }
  • 42. Stage 4: Implementation - Transactions What if the commit fails? if ($@) { # catch exception $main_db->rollback; # roll main_db back $marks_db->rollback; # roll marks_db back } else { eval { $main_db->commit }; if ($@) { $main_db->rollback; $marks_db->rollback; } eval { $marks_db->commit }; ...
  • 43. Stage 4: Implementation - Transactions CAP (Brewer’s Law)
  • 44. Stage 4: Implementation - Transactions Consistency or Availability?
  • 45. Stage 4: Implementation - Transactions 9 out of 10 users prefer availability So does customer support. You can fix consistency.
  • 46. Stage 4: Implementation - ORMs ORMs are full of pain ● They hide away db connection details. ● They make it hard to break models apart. ● They make writing code easy… ● But debugging is much more difficult.
  • 47. Stage 4: Implementation - ORMs ORMs are full of pain Back in my day we used SQL, and we liked it. $classes = $c->classes->search( $select_hash, { '+select' => 'source.id', '+as' => 'src_id', 'join' => [ { 'user_rights_class' => { 'user_role' => 'owner' } }, 'source' ], 'rows' => 200, 'page' => 1 } );
  • 48. Stage 4: Implementation - Juggling Talking to two databases is easy, right?
  • 49. Stage 4: Implementation - Juggling Talking to two databases is easy, right? Not as easy as it seems.
  • 50. Stage 4: Implementation - Juggling Main database - Marks database Are you talking to me?
  • 51. Stage 4: Implementation - Juggling Main database - Marks database I think he was talking to me.
  • 52. Stage 4: Implementation - Config ● Main Database: One master, two slaves (2) ● Marks Database: One master, two slaves (2) ● ASP application: write user, read only user (2) ● Catalyst Application: write user, read only user (2) ● REST Application: write user, read only user (2) ● dev, qa, staging, production, sandbox, uk (6)
  • 53. Stage 4: Implementation - Config ● Database hosts and users: 2*5 = 10 ● Stages: 10 * 6 = 60 ● Config managed in version control, no discovery. ● Config deployed via RPM with application. ● Get one wrong? Start all over again. ● Configuration is full of pain and suffering.
  • 54. Stage 4: Implementation - Config Yes, we are moving to Chef.
  • 55. Stage 4: Implementation - Tech Debt How much tech debt do you have?
  • 56. Stage 4: Implementation - Tech Debt How much tech debt do you have? More than you think.
  • 57. Stage 4: Implementation - Tech Debt How much of it will you have to deal with?
  • 58. Stage 4: Implementation - Tech Debt How much of it will you have to deal with? More than you think.
  • 59. Stage 4: Implementation - Tech Debt Our legacy app: ● 5 ORMs ● No unit tests (many integration tests) ● Two template frameworks ● 9 different log files ● Code is generally pretty readable!
  • 60. Stage 4: Implementation - Tech Debt
  • 61. Stage 5: Release Planned 8 hour Maintenance Window 15 People + support 2.5 Hours Main Service 1.5 Hours UK 2 Hours Sandbox + Cat Videos
  • 63. Stage 6: Cleanup Patch Flavors: How Did That Get there? That’s a bug. It worked fine in dev.
  • 64. Stage 6: Cleanup “Sometimes the query planner does dumb things” o People forget why you embarked on this effort. o People forget the successes and risk mitigation. o People won’t forget the visceral reactions to service degradations.
  • 65. Stage 6: Cleanup How to bring your site to a halt: 1.Start transaction to database 1 2.Start transaction to database 2 3.Wait for database 1 to finish
  • 67. Stage 6: Cleanup Gone in 60 seconds
  • 69. Stage 6: Cleanup Where Do We Golang From here? Back To Plan A. Most of the heavy lifting is done. “The first split is the hardest” - Some Guy Here
  • 70. The End So long SurgeCon! And thanks for the bacon.