SlideShare a Scribd company logo
Highload++ 2010
Scaling with Postgres
Robert Treat
Monday, October 25, 2010
Who Am I?
✤ Robert Treat
✤ OmniTI
✤ Design, Development,
Database, Ops
Monday, October 25, 2010
Who Am I?
✤ Robert Treat
✤ OmniTI
✤ Design, Development,
DATABASE, Ops
Monday, October 25, 2010
Who Am I?
✤ Robert Treat
✤ OmniTI
✤ Design, Development,
DATABASE, Ops
✤ Etsy, Allisports,
National Geographic,
Gilt, etc...
Monday, October 25, 2010
Who Am I?
✤ Robert Treat
✤ Postgres
✤ Web, Advocacy,
phpPgAdmin
✤ Major Contributor
Monday, October 25, 2010
Who Am I?
✤ Postgres 6.5 -> 9.1alpha1
✤ Terabytes of data
✤ Millions of transactions per day
✤ OLTP, ODS, DW
✤ Perl, PHP, Java, Ruby, C#
Monday, October 25, 2010
Who Am I?
OBSERVATION == LEARNING
(hopefully)
Monday, October 25, 2010
Scalability
It is the ability of a computer
application or product (hardware
or software) to continue to
function well when it (or its
context) is changed in size or
volume in order to meet a user
need.
Monday, October 25, 2010
Scalability
Given ever increasing load
Monday, October 25, 2010
Scalability
NEVER GO DOWN
ALWAYS PERFORM WELL
Given ever increasing load
Monday, October 25, 2010
Scalability
NEVER GO DOWN
ALWAYS PERFORM WELL
Given ever increasing load
impossible goal, but we’ll try
Monday, October 25, 2010
Scalability
NEVER GO DOWN
ALWAYS PERFORM WELL
Given ever increasing load
NOTE! data loss is not a goal, but ideally we won’t lose it :-)
Monday, October 25, 2010
It starts with culture...
Monday, October 25, 2010
✤ Get over schema purity
✤ add column default not null
Monday, October 25, 2010
✤ Get over schema purity
✤ add column default not null
Good performance comes from good schema
design, HOWEVER, perfect relational
modeling is NOT THE GOAL
Monday, October 25, 2010
✤ Devs must own schema and queries
✤ they design, you refine
Monday, October 25, 2010
✤ Devs must own schema and queries
✤ they design, you refine
Performance and scalability cannot be
managed solely within the database; both
require application level knowledge. To
achieve this, application developers need to
have visibility of the resources they work on
Monday, October 25, 2010
GainVisibility
Monday, October 25, 2010
GainVisibility
✤ Monitoring
✤ Alerts
✤ Trending
✤ Capacity Planning
✤ Performance Tuning
Monday, October 25, 2010
GainVisibility
✤ Alerts
✤ server: out of disk space, high load, etc...
✤ database: connections, sequences, etc...
✤ business: registrations, revenue, etc...
✤ etc...
check_postgres.pl
Monday, October 25, 2010
GainVisibility
✤ Trending
✤ server: disk usage, load, etc...
✤ database: connections, sequences, etc...
✤ business: registrations, revenue, etc...
✤ etc...
cacti, mrtg, circonus
Monday, October 25, 2010
GainVisibility
✤ Capacity Planning
✤ disks, cpu, memory
✤ connections, vacuum, bloat
simple projections, done regularly, are good enough
Monday, October 25, 2010
GainVisibility
✤ Performance tuning
✤ how long do queries take?
✤ how often do they run?
pgfouine
Monday, October 25, 2010
GainVisibility
COMMITS/PUSHES
Monday, October 25, 2010
GainVisibility
ALL alerts, graphs, query reports, etc...
MUST be available to EVERYONE on
the team AT ALL TIMES
Monday, October 25, 2010
Hands on
You can’t succeed without first putting
the right culture in place.
Once you are on the right path, make
sure you have the right technology
Monday, October 25, 2010
PostgresVersions
✤ MINIMUM: 8.3
✤ removes xid for read only queries, significant reduction in vacuum
activity
Monday, October 25, 2010
PostgresVersions
✤ MINIMUM: 8.3
✤ removes xid for read only queries, significant reduction in vacuum
activity
seriously!
Monday, October 25, 2010
PostgresVersions
✤ MINIMUM: 8.3
✤ removes xid for read only queries, significant reduction in vacuum
activity
✤ BETTER: 8.4
✤ revised free space map management leads to more efficient
vacuuming
Monday, October 25, 2010
PostgresVersions
✤ MINIMUM: 8.3
✤ removes xid for read only queries, significant reduction in vacuum
activity
✤ BETTER: 8.4
✤ revised free space map management leads to more efficient
vacuuming
✤ WHY NOT? 9.0
✤ Hot standby / streaming replication couldn’t hurt
Monday, October 25, 2010
Speaking of replication
✤ Common practice for scaling websites
✤ Good for READ based loads
✤ We have used many:
✤ slony, rubyrep, bucardo, 9.0 built-in, mammoth, wrote-our-own
Monday, October 25, 2010
Speaking of replication
Monday, October 25, 2010
Speaking of replication
✤ No favorite system for this, evaluate based on:
✤ avoid solutions that duplicate writes at sql level (imho)
✤ how comfortable am I debugging the system?
✤ do you need automated schema changes?
✤ how much redundancy / complexity do you need?
✤ how does the system handle node failure for N nodes?
Monday, October 25, 2010
So what would you use? (tm)
✤ 2 Nodes, master + standby: Postgres 9.0
✤ Master + multiple slaves: Slony
✤ Master-Master: Bucardo
All choices subject to change!!
Monday, October 25, 2010
A word about “Sharding”
✤ Distributed computing is hard(er)
✤ we think of things in a singular global state
✤ the more we can work in that model, the better
✤ RDBM offer poor solutions for multiple masters
✤ you must manage that complexity on your own
Monday, October 25, 2010
A word about “Sharding”
✤ Splitting systems by service:
✤ separate db for login, forums, sales, etc...
✤ allows for growth
✤ provides simple interface
Monday, October 25, 2010
Pooling
✤ Postgres connections are expensive!
✤ fork new process per connection
✤ keep 1 process open per connection
✤ 1000+ processes you will notice trouble
Monday, October 25, 2010
Pooling
✤ Postgres connections are expensive!
✤ fork new process per connection
✤ keep 1 process open per connection
✤ 1000+ processes you will notice trouble
✤ POOLING
✤ JDBC, mod-perl
✤ pgbouncer ftw!
Monday, October 25, 2010
Summary
✤ Schema / Queries should be shared between dev, dba teams!
✤ Monitoring + Visibility!
✤ >= 8.3 Required!
✤ Replication, jump in it!
✤ Use connection pooling!
Monday, October 25, 2010
Thanks!
more:
@robtreat2
www.xzilla.net
Oleg & Crew
Highload++
OmniTI
Postgres Community!
You!
Monday, October 25, 2010
Ad

Recommended

DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
FITC
 
Nuxeo World 2013] HOW TO CONTRIBUTE TO THE COMMUNITY - LAURENT DOGUIN
Nuxeo World 2013] HOW TO CONTRIBUTE TO THE COMMUNITY - LAURENT DOGUIN
Nuxeo
 
Less Alarming Alerts - SRECon 2016
Less Alarming Alerts - SRECon 2016
Robert Treat
 
GeoServer on Steroids
GeoServer on Steroids
GeoSolutions
 
Postgres Scaling Opportunities and Options
Postgres Scaling Opportunities and Options
EDB
 
What Ops Can Learn From Design
What Ops Can Learn From Design
Robert Treat
 
Beyond Commodities - Gulf investors and the new Africa
Beyond Commodities - Gulf investors and the new Africa
Joannes Mongardini
 
Reactive Navigation of Autonomous Mobile Robot Using Neuro-Fuzzy System
Reactive Navigation of Autonomous Mobile Robot Using Neuro-Fuzzy System
Waqas Tariq
 
Ping pong & tennis.
Ping pong & tennis.
BentonGeometry
 
EKO 4 Company Overview
EKO 4 Company Overview
Vess Christoph
 
Annual_Report_2015_04_Final_Single-Page
Annual_Report_2015_04_Final_Single-Page
Heather Thomas
 
Getting your name out there
Getting your name out there
Alex Cato
 
Dr ravi r kasliwal cardiologist medanta medicity
Dr ravi r kasliwal cardiologist medanta medicity
Dr R R Kasliwal
 
Less Alarming Alerts!
Less Alarming Alerts!
Robert Treat
 
Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016
Robert Treat
 
Postgres 9.4 First Look
Postgres 9.4 First Look
Robert Treat
 
Managing Databases In A DevOps Environment
Managing Databases In A DevOps Environment
Robert Treat
 
Modern Monitoring - devopsdays Cuba
Modern Monitoring - devopsdays Cuba
bridgetkromhout
 
Scaling up task processing with Celery
Scaling up task processing with Celery
Nicolas Grasset
 
Salam_rahal_CV
Salam_rahal_CV
Salam Rahal
 
rough draft sketches
rough draft sketches
bano2630
 
Scaling with Postgres (Robert Treat)
Scaling with Postgres (Robert Treat)
Ontico
 
Check Please!
Check Please!
Robert Treat
 
Top 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres Deployment
EDB
 
Top10 list planningpostgresdeployment.2014
Top10 list planningpostgresdeployment.2014
EDB
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
Postgres in Production - Best Practices 2014
Postgres in Production - Best Practices 2014
EDB
 
Postgres in production.2014
Postgres in production.2014
EDB
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008
Robert Treat
 
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
Equnix Business Solutions
 

More Related Content

Viewers also liked (13)

Ping pong & tennis.
Ping pong & tennis.
BentonGeometry
 
EKO 4 Company Overview
EKO 4 Company Overview
Vess Christoph
 
Annual_Report_2015_04_Final_Single-Page
Annual_Report_2015_04_Final_Single-Page
Heather Thomas
 
Getting your name out there
Getting your name out there
Alex Cato
 
Dr ravi r kasliwal cardiologist medanta medicity
Dr ravi r kasliwal cardiologist medanta medicity
Dr R R Kasliwal
 
Less Alarming Alerts!
Less Alarming Alerts!
Robert Treat
 
Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016
Robert Treat
 
Postgres 9.4 First Look
Postgres 9.4 First Look
Robert Treat
 
Managing Databases In A DevOps Environment
Managing Databases In A DevOps Environment
Robert Treat
 
Modern Monitoring - devopsdays Cuba
Modern Monitoring - devopsdays Cuba
bridgetkromhout
 
Scaling up task processing with Celery
Scaling up task processing with Celery
Nicolas Grasset
 
Salam_rahal_CV
Salam_rahal_CV
Salam Rahal
 
rough draft sketches
rough draft sketches
bano2630
 
EKO 4 Company Overview
EKO 4 Company Overview
Vess Christoph
 
Annual_Report_2015_04_Final_Single-Page
Annual_Report_2015_04_Final_Single-Page
Heather Thomas
 
Getting your name out there
Getting your name out there
Alex Cato
 
Dr ravi r kasliwal cardiologist medanta medicity
Dr ravi r kasliwal cardiologist medanta medicity
Dr R R Kasliwal
 
Less Alarming Alerts!
Less Alarming Alerts!
Robert Treat
 
Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016
Robert Treat
 
Postgres 9.4 First Look
Postgres 9.4 First Look
Robert Treat
 
Managing Databases In A DevOps Environment
Managing Databases In A DevOps Environment
Robert Treat
 
Modern Monitoring - devopsdays Cuba
Modern Monitoring - devopsdays Cuba
bridgetkromhout
 
Scaling up task processing with Celery
Scaling up task processing with Celery
Nicolas Grasset
 
rough draft sketches
rough draft sketches
bano2630
 

Similar to Scaling with Postgres (Highload++ 2010) (20)

Scaling with Postgres (Robert Treat)
Scaling with Postgres (Robert Treat)
Ontico
 
Check Please!
Check Please!
Robert Treat
 
Top 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres Deployment
EDB
 
Top10 list planningpostgresdeployment.2014
Top10 list planningpostgresdeployment.2014
EDB
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
Postgres in Production - Best Practices 2014
Postgres in Production - Best Practices 2014
EDB
 
Postgres in production.2014
Postgres in production.2014
EDB
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008
Robert Treat
 
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
Equnix Business Solutions
 
How to be a Postgres DBA in a Pinch
How to be a Postgres DBA in a Pinch
ElizabethGarrettChri
 
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
 
PostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
Best Practices & Lessons Learned from Deployment of PostgreSQL
Best Practices & Lessons Learned from Deployment of PostgreSQL
EDB
 
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
DataStax
 
No sql findings
No sql findings
Christian van der Leeden
 
EnterpriseDB's Best Practices for Postgres DBAs
EnterpriseDB's Best Practices for Postgres DBAs
EDB
 
Tales from the Postgres Front - and What We Can Learn
Tales from the Postgres Front - and What We Can Learn
EDB
 
The Accidental DBA
The Accidental DBA
PostgreSQL Experts, Inc.
 
5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
Five steps perform_2009 (1)
Five steps perform_2009 (1)
PostgreSQL Experts, Inc.
 
Scaling with Postgres (Robert Treat)
Scaling with Postgres (Robert Treat)
Ontico
 
Top 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres Deployment
EDB
 
Top10 list planningpostgresdeployment.2014
Top10 list planningpostgresdeployment.2014
EDB
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
Postgres in Production - Best Practices 2014
Postgres in Production - Best Practices 2014
EDB
 
Postgres in production.2014
Postgres in production.2014
EDB
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008
Robert Treat
 
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
PGConf.ASIA 2019 Bali - Keynote Speech 2 - Ivan Pachenko
Equnix Business Solutions
 
How to be a Postgres DBA in a Pinch
How to be a Postgres DBA in a Pinch
ElizabethGarrettChri
 
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
 
PostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
Best Practices & Lessons Learned from Deployment of PostgreSQL
Best Practices & Lessons Learned from Deployment of PostgreSQL
EDB
 
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
DataStax
 
EnterpriseDB's Best Practices for Postgres DBAs
EnterpriseDB's Best Practices for Postgres DBAs
EDB
 
Tales from the Postgres Front - and What We Can Learn
Tales from the Postgres Front - and What We Can Learn
EDB
 
Ad

More from Robert Treat (19)

Advanced Int->Bigint Conversions
Advanced Int->Bigint Conversions
Robert Treat
 
Explaining Explain
Explaining Explain
Robert Treat
 
the-lost-art-of-plpgsql
the-lost-art-of-plpgsql
Robert Treat
 
Managing Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs Monitoring
Robert Treat
 
Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013
Robert Treat
 
Big Bad "Upgraded" Postgres
Big Bad "Upgraded" Postgres
Robert Treat
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.conf
Robert Treat
 
Pro Postgres 9
Pro Postgres 9
Robert Treat
 
Advanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITR
Robert Treat
 
Intro to Postgres 9 Tutorial
Intro to Postgres 9 Tutorial
Robert Treat
 
Database Scalability Patterns
Database Scalability Patterns
Robert Treat
 
A Guide To PostgreSQL 9.0
A Guide To PostgreSQL 9.0
Robert Treat
 
Scaling With Postgres
Scaling With Postgres
Robert Treat
 
Intro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 Tutorial
Robert Treat
 
Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007
Robert Treat
 
The Essential postgresql.conf
The Essential postgresql.conf
Robert Treat
 
PostgreSQL Partitioning, PGCon 2007
PostgreSQL Partitioning, PGCon 2007
Robert Treat
 
Database Anti Patterns
Database Anti Patterns
Robert Treat
 
Pro PostgreSQL
Pro PostgreSQL
Robert Treat
 
Advanced Int->Bigint Conversions
Advanced Int->Bigint Conversions
Robert Treat
 
Explaining Explain
Explaining Explain
Robert Treat
 
the-lost-art-of-plpgsql
the-lost-art-of-plpgsql
Robert Treat
 
Managing Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs Monitoring
Robert Treat
 
Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013
Robert Treat
 
Big Bad "Upgraded" Postgres
Big Bad "Upgraded" Postgres
Robert Treat
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.conf
Robert Treat
 
Advanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITR
Robert Treat
 
Intro to Postgres 9 Tutorial
Intro to Postgres 9 Tutorial
Robert Treat
 
Database Scalability Patterns
Database Scalability Patterns
Robert Treat
 
A Guide To PostgreSQL 9.0
A Guide To PostgreSQL 9.0
Robert Treat
 
Scaling With Postgres
Scaling With Postgres
Robert Treat
 
Intro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 Tutorial
Robert Treat
 
Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007
Robert Treat
 
The Essential postgresql.conf
The Essential postgresql.conf
Robert Treat
 
PostgreSQL Partitioning, PGCon 2007
PostgreSQL Partitioning, PGCon 2007
Robert Treat
 
Database Anti Patterns
Database Anti Patterns
Robert Treat
 
Ad

Recently uploaded (20)

ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 

Scaling with Postgres (Highload++ 2010)

  • 1. Highload++ 2010 Scaling with Postgres Robert Treat Monday, October 25, 2010
  • 2. Who Am I? ✤ Robert Treat ✤ OmniTI ✤ Design, Development, Database, Ops Monday, October 25, 2010
  • 3. Who Am I? ✤ Robert Treat ✤ OmniTI ✤ Design, Development, DATABASE, Ops Monday, October 25, 2010
  • 4. Who Am I? ✤ Robert Treat ✤ OmniTI ✤ Design, Development, DATABASE, Ops ✤ Etsy, Allisports, National Geographic, Gilt, etc... Monday, October 25, 2010
  • 5. Who Am I? ✤ Robert Treat ✤ Postgres ✤ Web, Advocacy, phpPgAdmin ✤ Major Contributor Monday, October 25, 2010
  • 6. Who Am I? ✤ Postgres 6.5 -> 9.1alpha1 ✤ Terabytes of data ✤ Millions of transactions per day ✤ OLTP, ODS, DW ✤ Perl, PHP, Java, Ruby, C# Monday, October 25, 2010
  • 7. Who Am I? OBSERVATION == LEARNING (hopefully) Monday, October 25, 2010
  • 8. Scalability It is the ability of a computer application or product (hardware or software) to continue to function well when it (or its context) is changed in size or volume in order to meet a user need. Monday, October 25, 2010
  • 9. Scalability Given ever increasing load Monday, October 25, 2010
  • 10. Scalability NEVER GO DOWN ALWAYS PERFORM WELL Given ever increasing load Monday, October 25, 2010
  • 11. Scalability NEVER GO DOWN ALWAYS PERFORM WELL Given ever increasing load impossible goal, but we’ll try Monday, October 25, 2010
  • 12. Scalability NEVER GO DOWN ALWAYS PERFORM WELL Given ever increasing load NOTE! data loss is not a goal, but ideally we won’t lose it :-) Monday, October 25, 2010
  • 13. It starts with culture... Monday, October 25, 2010
  • 14. ✤ Get over schema purity ✤ add column default not null Monday, October 25, 2010
  • 15. ✤ Get over schema purity ✤ add column default not null Good performance comes from good schema design, HOWEVER, perfect relational modeling is NOT THE GOAL Monday, October 25, 2010
  • 16. ✤ Devs must own schema and queries ✤ they design, you refine Monday, October 25, 2010
  • 17. ✤ Devs must own schema and queries ✤ they design, you refine Performance and scalability cannot be managed solely within the database; both require application level knowledge. To achieve this, application developers need to have visibility of the resources they work on Monday, October 25, 2010
  • 19. GainVisibility ✤ Monitoring ✤ Alerts ✤ Trending ✤ Capacity Planning ✤ Performance Tuning Monday, October 25, 2010
  • 20. GainVisibility ✤ Alerts ✤ server: out of disk space, high load, etc... ✤ database: connections, sequences, etc... ✤ business: registrations, revenue, etc... ✤ etc... check_postgres.pl Monday, October 25, 2010
  • 21. GainVisibility ✤ Trending ✤ server: disk usage, load, etc... ✤ database: connections, sequences, etc... ✤ business: registrations, revenue, etc... ✤ etc... cacti, mrtg, circonus Monday, October 25, 2010
  • 22. GainVisibility ✤ Capacity Planning ✤ disks, cpu, memory ✤ connections, vacuum, bloat simple projections, done regularly, are good enough Monday, October 25, 2010
  • 23. GainVisibility ✤ Performance tuning ✤ how long do queries take? ✤ how often do they run? pgfouine Monday, October 25, 2010
  • 25. GainVisibility ALL alerts, graphs, query reports, etc... MUST be available to EVERYONE on the team AT ALL TIMES Monday, October 25, 2010
  • 26. Hands on You can’t succeed without first putting the right culture in place. Once you are on the right path, make sure you have the right technology Monday, October 25, 2010
  • 27. PostgresVersions ✤ MINIMUM: 8.3 ✤ removes xid for read only queries, significant reduction in vacuum activity Monday, October 25, 2010
  • 28. PostgresVersions ✤ MINIMUM: 8.3 ✤ removes xid for read only queries, significant reduction in vacuum activity seriously! Monday, October 25, 2010
  • 29. PostgresVersions ✤ MINIMUM: 8.3 ✤ removes xid for read only queries, significant reduction in vacuum activity ✤ BETTER: 8.4 ✤ revised free space map management leads to more efficient vacuuming Monday, October 25, 2010
  • 30. PostgresVersions ✤ MINIMUM: 8.3 ✤ removes xid for read only queries, significant reduction in vacuum activity ✤ BETTER: 8.4 ✤ revised free space map management leads to more efficient vacuuming ✤ WHY NOT? 9.0 ✤ Hot standby / streaming replication couldn’t hurt Monday, October 25, 2010
  • 31. Speaking of replication ✤ Common practice for scaling websites ✤ Good for READ based loads ✤ We have used many: ✤ slony, rubyrep, bucardo, 9.0 built-in, mammoth, wrote-our-own Monday, October 25, 2010
  • 33. Speaking of replication ✤ No favorite system for this, evaluate based on: ✤ avoid solutions that duplicate writes at sql level (imho) ✤ how comfortable am I debugging the system? ✤ do you need automated schema changes? ✤ how much redundancy / complexity do you need? ✤ how does the system handle node failure for N nodes? Monday, October 25, 2010
  • 34. So what would you use? (tm) ✤ 2 Nodes, master + standby: Postgres 9.0 ✤ Master + multiple slaves: Slony ✤ Master-Master: Bucardo All choices subject to change!! Monday, October 25, 2010
  • 35. A word about “Sharding” ✤ Distributed computing is hard(er) ✤ we think of things in a singular global state ✤ the more we can work in that model, the better ✤ RDBM offer poor solutions for multiple masters ✤ you must manage that complexity on your own Monday, October 25, 2010
  • 36. A word about “Sharding” ✤ Splitting systems by service: ✤ separate db for login, forums, sales, etc... ✤ allows for growth ✤ provides simple interface Monday, October 25, 2010
  • 37. Pooling ✤ Postgres connections are expensive! ✤ fork new process per connection ✤ keep 1 process open per connection ✤ 1000+ processes you will notice trouble Monday, October 25, 2010
  • 38. Pooling ✤ Postgres connections are expensive! ✤ fork new process per connection ✤ keep 1 process open per connection ✤ 1000+ processes you will notice trouble ✤ POOLING ✤ JDBC, mod-perl ✤ pgbouncer ftw! Monday, October 25, 2010
  • 39. Summary ✤ Schema / Queries should be shared between dev, dba teams! ✤ Monitoring + Visibility! ✤ >= 8.3 Required! ✤ Replication, jump in it! ✤ Use connection pooling! Monday, October 25, 2010