The Magic of Tuning in PostgreSQL

Ashnikbiz
AshnikbizAshnikbiz
Scaling with PostgreSQL
Magic of Tuning and Connection Pooling
Pitfalls where IT Mangers get Trapped
• Failure to have a correct plan for scaling with
business
• Falling prey to proprietary database vendors
and their costly hardware
• Failing to identify the correct Core-Memory
Ratio
• Adding Resources will not help all the time
Benchmark Studies: Objective
• See how PostgreSQL scales with hardware
• See how PostgreSQL scales with tuning
• See the effect of proper Connection and Transaction
Management on PostgreSQL performance
• Highlight the importance of Tuning despite increasing
system hardware
Benchmark Studies: Test bed Setup
We have used HammerDB for this benchmark
• An open source benchmarking tool which provides test cases for TPC-C and
TPC-H benchmarks
• We used TPC-C for our tests
All the tests were run on a Virtual Machine (using VM player) on a Laptop
• 64-bit Intel 8 core CPU
• 16 GB of physical memory
• Host OS- Windows 7 64 bit
Testing Environment
• Postgres Plus Advanced Server v9.2
• Running on Red Hat Enterprise Linux v6.1 (with kernel version 2.6)
Disclaimer
• Performance without tuning and with tuning is shared here
to make a point
• The tests were done on a virtual environment running on a
low end host machine
• Scalability or raw performance numbers presented here are
not true indicators of capabilities of PostgreSQL/Postgres
Plus Advanced Server
• With the real server class machines these numbers would be
much higher than on the test machine
Low Configuration PostgreSQL server scaling with
Connection Pooling
Database Parameters:
• No of Processors: 1
• Memory: 3GB,
• shared_buffer: 32MB,
• effective_cache_size: 128MB
• work_mem=1MB
Key Learning:
Test 1
- The performance degrades once the load increases beyond a point [sounds familiar?]
Test 2
- Session Level Connection pooling with max 50 connections in Pool
- Connections aquired as needed so not much difference than first test
Test 3
- Transaction Level Connection Pooling with 25 connections
- Does well as concurrency increases [scaling with growth!!!]
Inconsistent/low and
highs can be attributed
to resources contention
during autovacuum
Some Important Parameters for Tuning in
PostgreSQL
• shared_buffer
• effective_cache_size
• work_mem
• wal_buffer
• bgwriter_delay
• effective_io_concurrency
• checkpoint_segment
• checkpoint_timeout
• random_page_cost
• autovacuum_naptime
• autovacuum_vacuum_threshold
• autovacuum_analyze_threshold
• autovacuum_vacuum_scale_factor
• autovacuum_analyze_scale_factor
• autovacuum_vacuum_cost_delay
PostgreSQL Performs better after Tuning
Database Parameters:
• No of Processors: 1
• Memory: 3GB,
• shared_buffer: 32MB/256MB,
• effective_cache_size: 128MB/750MB
• work_mem=1MB
Key Learning:
Test 1: Basic Setup
- The performance degrades once the load increases beyond a point [sounds familiar?]
Test 2: Tuned postgresql.conf for shared_buffer and effective_cache_size
- Up to 19% gain over basic configuration
Test 3: Tuned other parameters in postgresql.conf
- Up to 21% gain
- The occasional performance troughs because of vacuum operation is
not there anymore
Still the performance is
not scalable in any of the
3 cases and degrades
with concurrency [25-
30% loss]
Combining the Effect of Connection Pooling and
Tuning
Database Parameters:
• No of Processors: 1
• Memory: 3GB,
• shared_buffer: 256MB,
• effective_cache_size: 750MB
• work_mem=1MB
Key Learning:
Test 1: Basic Setup with tuned shared_buffer and effective_cache_size
- The performance degrades once the load increases beyond a point [sounds familiar?]
Test 2: Tuned other parameters in postgresql.conf
- Performance gain of up to 14%
- The performance continues to degrade [by a margin of 26%] at higher concurrency
Test 3: Transaction Level Connection Pooling
- Performance is more consistent
- Degradation/loss in performance at peak concurrency is quite less [14% only]
Finally we get
a consistently
scaling
Database
Setup
Tuning and proper Transaction Management
enhances the benefit of CPU addition
Database Parameters:
• No of Processors: 2
• Memory: 3GB,
• shared_buffer: 256MB,
• effective_cache_size: 750MB
• work_mem=1MB
Key Learning:
Test 1: Basic Setup with tuned shared_buffer and effective_cache_size
- The performance degrades once the load increases beyond a point
Test 2: Tuned other parameters in postgresql.conf
- Performance gain of 36% at Peak load
- The performance continues to degrade [by a margin of 26%] at higher concurrency
Test 3: Transaction Level Connection Pooling
- Performance is more consistent
- Improvement caused by tuning is more prominent with boosted computing
[1CPU- 46% | 2CPU- 80%]
Even after boosting
computing power,
to get best of
resources, tuning
and connection
pooling plays a
major role
Tuning and proper Transaction Management
enhances the benefit of Memory Upgrade
Database Parameters:
• No of Processors: 2
• Memory: 4.5GB,
• shared_buffer: 750MB,
• effective_cache_size: 2GB
• work_mem=1MB
Key Learning:
Test 1: Basic Setup with tuned shared_buffer[750MB] and effective_cache_size[2GB]
- The performance degrades once the load increases beyond a point
Test 2: Tuned other parameters in postgresql.conf
- Performance gain of 55% at Peak load
- The performance continues to degrade [by a margin of 15%] at higher concurrency
Test 3: Transaction Level Connection Pooling
- Performance is more consistent
- Gain with additional memory is more prominent after tuning and connection pooling
To make best use
of added memory
tuning and
connection
pooling are
important
Low Memory Tuned Postgres Vs Un-Tuned
Postgres with Higher Memory
Database Parameters:
• No of Processors: 2
• Memory: 3GB/4.5GB,
• shared_buffer: 256MB/750MB,
• effective_cache_size: 750MB/2GB
• work_mem=1MB
Key Learning:
Test 1: Un-tuned PostgreSQL [only shared_buffer and effective_cache_size is tuned]
with 4.5 GB RAM
- The performance continues to degrade [by a margin of 38%] at higher concurrency
Test 3: Tune PostgreSQL with Transaction Level Connection Pooling
- Performance is more consistent
- Despite low memory, performance is comparable at low concurrency
- A Tuned database with proper transaction management does better as load increases
Most of your
performance
issues can be
resolved with
proper application
and database
tuning
Ashnik Message
• You don’t always need a high end system in the beginning to
scale in future
• There are commercially supported Open Source Solutions
available which scale as good as their proprietary
counterparts
• There is no generic core-memory formula- Our consultants
help customers identify what is best for them
• A well designed application with a well tuned database can
work better than a un-optimized database on a high end
server
How Ashnik Helps?
Server sizing
Health Check contracts on half yearly and annual terms
On-demand Health Check and Tuning services
Provide in migration services- $$ Saving by migrating from
costly proprietary database solutions
The Magic of Tuning in PostgreSQL
1 of 15

Recommended

PostgreSQL Hangout Parameter Tuning by
PostgreSQL Hangout Parameter TuningPostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter TuningAshnikbiz
2.5K views16 slides
Overview of Postgres Utility Processes by
Overview of Postgres Utility ProcessesOverview of Postgres Utility Processes
Overview of Postgres Utility ProcessesEDB
6K views12 slides
Linux internals for Database administrators at Linux Piter 2016 by
Linux internals for Database administrators at Linux Piter 2016Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016PostgreSQL-Consulting
1.5K views17 slides
5 Steps to PostgreSQL Performance by
5 Steps to PostgreSQL Performance5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL PerformanceCommand Prompt., Inc
77.3K views55 slides
Linux tuning to improve PostgreSQL performance by
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performancePostgreSQL-Consulting
35.9K views26 slides
PostgreSQL Hangout Replication Features v9.4 by
PostgreSQL Hangout Replication Features v9.4PostgreSQL Hangout Replication Features v9.4
PostgreSQL Hangout Replication Features v9.4Ashnikbiz
1.2K views17 slides

More Related Content

What's hot

Concurrency by
ConcurrencyConcurrency
ConcurrencyBiju Nair
2K views16 slides
2016 may-countdown-to-postgres-v96-parallel-query by
2016 may-countdown-to-postgres-v96-parallel-query2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-queryAshnikbiz
391 views23 slides
X-DB Replication Server and MMR by
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMRAshnikbiz
2.7K views17 slides
Postgres in Amazon RDS by
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDSDenish Patel
9.7K views37 slides
Get to know PostgreSQL! by
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!Oddbjørn Steffensen
13.9K views110 slides
Out of the box replication in postgres 9.4 by
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
11.7K views50 slides

What's hot(20)

Concurrency by Biju Nair
ConcurrencyConcurrency
Concurrency
Biju Nair2K views
2016 may-countdown-to-postgres-v96-parallel-query by Ashnikbiz
2016 may-countdown-to-postgres-v96-parallel-query2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query
Ashnikbiz391 views
X-DB Replication Server and MMR by Ashnikbiz
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMR
Ashnikbiz2.7K views
Postgres in Amazon RDS by Denish Patel
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDS
Denish Patel9.7K views
Out of the box replication in postgres 9.4 by Denish Patel
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
Denish Patel11.7K views
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree by Ashnikbiz
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
Ashnikbiz761 views
Is There Anything PgBouncer Can’t Do? by EDB
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?
EDB244 views
PostreSQL HA and DR Setup & Use Cases by Ashnikbiz
PostreSQL HA and DR Setup & Use CasesPostreSQL HA and DR Setup & Use Cases
PostreSQL HA and DR Setup & Use Cases
Ashnikbiz1.8K views
Architecture for building scalable and highly available Postgres Cluster by Ashnikbiz
Architecture for building scalable and highly available Postgres ClusterArchitecture for building scalable and highly available Postgres Cluster
Architecture for building scalable and highly available Postgres Cluster
Ashnikbiz7.7K views
PostgreSQL 9.6 Performance-Scalability Improvements by PGConf APAC
PostgreSQL 9.6 Performance-Scalability ImprovementsPostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability Improvements
PGConf APAC2.6K views
Remote DBA Experts SQL Server 2008 New Features by Remote DBA Experts
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts4.5K views
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica... by Command Prompt., Inc
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Geographically Distributed PostgreSQL by mason_s
Geographically Distributed PostgreSQLGeographically Distributed PostgreSQL
Geographically Distributed PostgreSQL
mason_s13.9K views
Enterprise PostgreSQL - EDB's answer to conventional Databases by Ashnikbiz
Enterprise PostgreSQL - EDB's answer to conventional DatabasesEnterprise PostgreSQL - EDB's answer to conventional Databases
Enterprise PostgreSQL - EDB's answer to conventional Databases
Ashnikbiz2.2K views
Postgres on OpenStack by EDB
Postgres on OpenStackPostgres on OpenStack
Postgres on OpenStack
EDB5.5K views
Why we love pgpool-II and why we hate it! by PGConf APAC
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!
PGConf APAC6K views
MySQL Performance Tuning at COSCUP 2014 by Ryusuke Kajiyama
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
Ryusuke Kajiyama9.2K views
PostgreSQL Scaling And Failover by John Paulett
PostgreSQL Scaling And FailoverPostgreSQL Scaling And Failover
PostgreSQL Scaling And Failover
John Paulett24.7K views

Viewers also liked

Best Practices for Becoming an Exceptional Postgres DBA by
Best Practices for Becoming an Exceptional Postgres DBA Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA EDB
18.3K views48 slides
Postgres in Production - Best Practices 2014 by
Postgres in Production - Best Practices 2014Postgres in Production - Best Practices 2014
Postgres in Production - Best Practices 2014EDB
29.4K views31 slides
Mastering PostgreSQL Administration by
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
7.2K views111 slides
Deep dive into PostgreSQL statistics. by
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Alexey Lesovsky
22.9K views53 slides
PostgreSQL Administration for System Administrators by
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsCommand Prompt., Inc
7K views28 slides
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables by
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesPostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesSperasoft
20.2K views20 slides

Viewers also liked(18)

Best Practices for Becoming an Exceptional Postgres DBA by EDB
Best Practices for Becoming an Exceptional Postgres DBA Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB18.3K views
Postgres in Production - Best Practices 2014 by EDB
Postgres in Production - Best Practices 2014Postgres in Production - Best Practices 2014
Postgres in Production - Best Practices 2014
EDB29.4K views
Mastering PostgreSQL Administration by EDB
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB7.2K views
Deep dive into PostgreSQL statistics. by Alexey Lesovsky
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky22.9K views
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables by Sperasoft
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesPostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
Sperasoft20.2K views
Postgresql database administration volume 1 by Federico Campoli
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1
Federico Campoli33.3K views
PostgreSQL performance improvements in 9.5 and 9.6 by Tomas Vondra
PostgreSQL performance improvements in 9.5 and 9.6PostgreSQL performance improvements in 9.5 and 9.6
PostgreSQL performance improvements in 9.5 and 9.6
Tomas Vondra14.2K views
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015 by PostgreSQL-Consulting
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
Streaming replication in practice by Alexey Lesovsky
Streaming replication in practiceStreaming replication in practice
Streaming replication in practice
Alexey Lesovsky8.7K views
PgDay Asia 2016 - Security Best Practices for your Postgres Deployment by Ashnikbiz
PgDay Asia 2016 - Security Best Practices for your Postgres DeploymentPgDay Asia 2016 - Security Best Practices for your Postgres Deployment
PgDay Asia 2016 - Security Best Practices for your Postgres Deployment
Ashnikbiz816 views
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications by Ashnikbiz
FOSSASIA 2016 - 7 Tips to design web centric high-performance applicationsFOSSASIA 2016 - 7 Tips to design web centric high-performance applications
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
Ashnikbiz473 views
Tuning Slow Running SQLs in PostgreSQL by Ashnikbiz
Tuning Slow Running SQLs in PostgreSQLTuning Slow Running SQLs in PostgreSQL
Tuning Slow Running SQLs in PostgreSQL
Ashnikbiz2.8K views
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr... by Ashnikbiz
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
Ashnikbiz716 views
Transform your DBMS to drive engagement innovation with Big Data by Ashnikbiz
Transform your DBMS to drive engagement innovation with Big DataTransform your DBMS to drive engagement innovation with Big Data
Transform your DBMS to drive engagement innovation with Big Data
Ashnikbiz509 views
NGINX Plus PLATFORM For Flawless Application Delivery by Ashnikbiz
NGINX Plus PLATFORM For Flawless Application DeliveryNGINX Plus PLATFORM For Flawless Application Delivery
NGINX Plus PLATFORM For Flawless Application Delivery
Ashnikbiz1.1K views
Streaming replication in PostgreSQL by Ashnikbiz
Streaming replication in PostgreSQLStreaming replication in PostgreSQL
Streaming replication in PostgreSQL
Ashnikbiz1.9K views
Building Hybrid data cluster using PostgreSQL and MongoDB by Ashnikbiz
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDB
Ashnikbiz3.6K views

Similar to The Magic of Tuning in PostgreSQL

MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDB by
MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDBMongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDB
MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDBMongoDB
1.3K views51 slides
Webinar: Best Practices for Upgrading to MongoDB 3.2 by
Webinar: Best Practices for Upgrading to MongoDB 3.2Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2Dana Elisabeth Groce
4.7K views53 slides
Connection Pooling in PostgreSQL using pgbouncer by
Connection Pooling in PostgreSQL using pgbouncer Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer Sameer Kumar
3.7K views19 slides
Adding Value in the Cloud with Performance Test by
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestRodolfo Kohn
1.1K views41 slides
071410 sun a_1515_feldman_stephen by
071410 sun a_1515_feldman_stephen071410 sun a_1515_feldman_stephen
071410 sun a_1515_feldman_stephenSteve Feldman
431 views29 slides
Performance tuning in sql server by
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql serverAntonios Chatzipavlis
3K views83 slides

Similar to The Magic of Tuning in PostgreSQL(20)

MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDB by MongoDB
MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDBMongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDB
MongoDB Days Silicon Valley: Best Practices for Upgrading to MongoDB
MongoDB1.3K views
Webinar: Best Practices for Upgrading to MongoDB 3.2 by Dana Elisabeth Groce
Webinar: Best Practices for Upgrading to MongoDB 3.2Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2
Connection Pooling in PostgreSQL using pgbouncer by Sameer Kumar
Connection Pooling in PostgreSQL using pgbouncer Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer
Sameer Kumar3.7K views
Adding Value in the Cloud with Performance Test by Rodolfo Kohn
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance Test
Rodolfo Kohn1.1K views
071410 sun a_1515_feldman_stephen by Steve Feldman
071410 sun a_1515_feldman_stephen071410 sun a_1515_feldman_stephen
071410 sun a_1515_feldman_stephen
Steve Feldman431 views
ATAGTR2017 Batch Workload Modelling and Performance Optimization by Agile Testing Alliance
ATAGTR2017 Batch Workload Modelling and Performance Optimization ATAGTR2017 Batch Workload Modelling and Performance Optimization
ATAGTR2017 Batch Workload Modelling and Performance Optimization
Weblogic Cluster advanced performance tuning by Aditya Bhuyan
Weblogic Cluster advanced performance tuningWeblogic Cluster advanced performance tuning
Weblogic Cluster advanced performance tuning
Aditya Bhuyan799 views
Weblogic performance tuning2 by Aditya Bhuyan
Weblogic performance tuning2Weblogic performance tuning2
Weblogic performance tuning2
Aditya Bhuyan281 views
Weblogic performance tuning1 by Aditya Bhuyan
Weblogic performance tuning1Weblogic performance tuning1
Weblogic performance tuning1
Aditya Bhuyan312 views
Weblogic Cluster performance tuning by Aditya Bhuyan
Weblogic Cluster performance tuningWeblogic Cluster performance tuning
Weblogic Cluster performance tuning
Aditya Bhuyan303 views
MariaDB Performance Tuning and Optimization by MariaDB plc
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
MariaDB plc11.3K views
MariaDB Server Performance Tuning & Optimization by MariaDB plc
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
MariaDB plc8.1K views
05. performance-concepts by Muhammad Ahad
05. performance-concepts05. performance-concepts
05. performance-concepts
Muhammad Ahad2.6K views
Performance Testing by Anu Shaji
Performance TestingPerformance Testing
Performance Testing
Anu Shaji69 views
PostgreSQL and Benchmarks by Jignesh Shah
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and Benchmarks
Jignesh Shah5.3K views
Oracle Database 12c features for DBA by Karan Kukreja
Oracle Database 12c features for DBAOracle Database 12c features for DBA
Oracle Database 12c features for DBA
Karan Kukreja292 views
Open Mic on Managed Mail Replica by jayeshpar2006
Open Mic on Managed Mail ReplicaOpen Mic on Managed Mail Replica
Open Mic on Managed Mail Replica
jayeshpar2006417 views
Seven deadly sins of ElasticSearch Benchmarking by Fan Robbin
Seven deadly sins of ElasticSearch BenchmarkingSeven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch Benchmarking
Fan Robbin12 views

More from Ashnikbiz

CloudOps_tool.pptx by
CloudOps_tool.pptxCloudOps_tool.pptx
CloudOps_tool.pptxAshnikbiz
20 views8 slides
Webinar_CloudOps final.pptx by
Webinar_CloudOps final.pptxWebinar_CloudOps final.pptx
Webinar_CloudOps final.pptxAshnikbiz
11 views8 slides
Autoscaling in Kubernetes (K8s) by
Autoscaling in Kubernetes (K8s)Autoscaling in Kubernetes (K8s)
Autoscaling in Kubernetes (K8s)Ashnikbiz
28 views8 slides
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli... by
Why and how to use Kubernetes  for scaling of your  multi-tier (n-tier) appli...Why and how to use Kubernetes  for scaling of your  multi-tier (n-tier) appli...
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...Ashnikbiz
32 views9 slides
Zero trust in a multi tenant environment by
Zero trust in a multi tenant environment  Zero trust in a multi tenant environment
Zero trust in a multi tenant environment Ashnikbiz
219 views10 slides
Deploy and automate ‘Secrets Management’ for a multi-cloud environment by
Deploy and automate ‘Secrets Management’ for a multi-cloud environmentDeploy and automate ‘Secrets Management’ for a multi-cloud environment
Deploy and automate ‘Secrets Management’ for a multi-cloud environmentAshnikbiz
94 views10 slides

More from Ashnikbiz(20)

CloudOps_tool.pptx by Ashnikbiz
CloudOps_tool.pptxCloudOps_tool.pptx
CloudOps_tool.pptx
Ashnikbiz20 views
Webinar_CloudOps final.pptx by Ashnikbiz
Webinar_CloudOps final.pptxWebinar_CloudOps final.pptx
Webinar_CloudOps final.pptx
Ashnikbiz11 views
Autoscaling in Kubernetes (K8s) by Ashnikbiz
Autoscaling in Kubernetes (K8s)Autoscaling in Kubernetes (K8s)
Autoscaling in Kubernetes (K8s)
Ashnikbiz28 views
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli... by Ashnikbiz
Why and how to use Kubernetes  for scaling of your  multi-tier (n-tier) appli...Why and how to use Kubernetes  for scaling of your  multi-tier (n-tier) appli...
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...
Ashnikbiz32 views
Zero trust in a multi tenant environment by Ashnikbiz
Zero trust in a multi tenant environment  Zero trust in a multi tenant environment
Zero trust in a multi tenant environment
Ashnikbiz219 views
Deploy and automate ‘Secrets Management’ for a multi-cloud environment by Ashnikbiz
Deploy and automate ‘Secrets Management’ for a multi-cloud environmentDeploy and automate ‘Secrets Management’ for a multi-cloud environment
Deploy and automate ‘Secrets Management’ for a multi-cloud environment
Ashnikbiz94 views
Deploy, move and manage Postgres across cloud platforms by Ashnikbiz
Deploy, move and manage Postgres across cloud platformsDeploy, move and manage Postgres across cloud platforms
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz116 views
Deploy, move and manage Postgres across cloud platforms by Ashnikbiz
Deploy, move and manage Postgres across cloud platformsDeploy, move and manage Postgres across cloud platforms
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz115 views
The Best Approach For Multi-cloud Infrastructure Provisioning-2 by Ashnikbiz
The Best Approach For Multi-cloud Infrastructure Provisioning-2The Best Approach For Multi-cloud Infrastructure Provisioning-2
The Best Approach For Multi-cloud Infrastructure Provisioning-2
Ashnikbiz97 views
The Best Approach For Multi-cloud Infrastructure Provisioning by Ashnikbiz
The Best Approach For Multi-cloud Infrastructure ProvisioningThe Best Approach For Multi-cloud Infrastructure Provisioning
The Best Approach For Multi-cloud Infrastructure Provisioning
Ashnikbiz119 views
Which PostgreSQL is right for your multi cloud strategy? P2 by Ashnikbiz
Which PostgreSQL is right for your multi cloud strategy? P2Which PostgreSQL is right for your multi cloud strategy? P2
Which PostgreSQL is right for your multi cloud strategy? P2
Ashnikbiz113 views
Which PostgreSQL is right for your multi cloud strategy? P1 by Ashnikbiz
Which PostgreSQL is right for your multi cloud strategy? P1Which PostgreSQL is right for your multi cloud strategy? P1
Which PostgreSQL is right for your multi cloud strategy? P1
Ashnikbiz79 views
Reduce the complexities of managing Kubernetes clusters anywhere 2 by Ashnikbiz
Reduce the complexities of managing Kubernetes clusters anywhere 2Reduce the complexities of managing Kubernetes clusters anywhere 2
Reduce the complexities of managing Kubernetes clusters anywhere 2
Ashnikbiz148 views
Reduce the complexities of managing Kubernetes clusters anywhere by Ashnikbiz
Reduce the complexities of managing Kubernetes clusters anywhereReduce the complexities of managing Kubernetes clusters anywhere
Reduce the complexities of managing Kubernetes clusters anywhere
Ashnikbiz77 views
Enhance your multi-cloud application performance using Redis Enterprise P2 by Ashnikbiz
Enhance your multi-cloud application performance using Redis Enterprise P2Enhance your multi-cloud application performance using Redis Enterprise P2
Enhance your multi-cloud application performance using Redis Enterprise P2
Ashnikbiz119 views
Enhance your multi-cloud application performance using Redis Enterprise P1 by Ashnikbiz
Enhance your multi-cloud application performance using Redis Enterprise P1Enhance your multi-cloud application performance using Redis Enterprise P1
Enhance your multi-cloud application performance using Redis Enterprise P1
Ashnikbiz77 views
Gain multi-cloud versatility with software load balancing designed for cloud-... by Ashnikbiz
Gain multi-cloud versatility with software load balancing designed for cloud-...Gain multi-cloud versatility with software load balancing designed for cloud-...
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz82 views
Gain multi-cloud versatility with software load balancing designed for cloud-... by Ashnikbiz
Gain multi-cloud versatility with software load balancing designed for cloud-...Gain multi-cloud versatility with software load balancing designed for cloud-...
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz75 views
Enterprise-class security with PostgreSQL - 1 by Ashnikbiz
Enterprise-class security with PostgreSQL - 1Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1
Ashnikbiz103 views
Enterprise-class security with PostgreSQL - 2 by Ashnikbiz
Enterprise-class security with PostgreSQL - 2Enterprise-class security with PostgreSQL - 2
Enterprise-class security with PostgreSQL - 2
Ashnikbiz79 views

Recently uploaded

Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...ShapeBlue
82 views62 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
40 views43 slides
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
77 views29 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
96 views7 slides
Network Source of Truth and Infrastructure as Code revisited by
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisitedNetwork Automation Forum
42 views45 slides
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
83 views15 slides

Recently uploaded(20)

Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue82 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman40 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc77 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue96 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue96 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue91 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue74 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue46 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue85 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue62 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue46 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue48 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu141 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue131 views

The Magic of Tuning in PostgreSQL

  • 1. Scaling with PostgreSQL Magic of Tuning and Connection Pooling
  • 2. Pitfalls where IT Mangers get Trapped • Failure to have a correct plan for scaling with business • Falling prey to proprietary database vendors and their costly hardware • Failing to identify the correct Core-Memory Ratio • Adding Resources will not help all the time
  • 3. Benchmark Studies: Objective • See how PostgreSQL scales with hardware • See how PostgreSQL scales with tuning • See the effect of proper Connection and Transaction Management on PostgreSQL performance • Highlight the importance of Tuning despite increasing system hardware
  • 4. Benchmark Studies: Test bed Setup We have used HammerDB for this benchmark • An open source benchmarking tool which provides test cases for TPC-C and TPC-H benchmarks • We used TPC-C for our tests All the tests were run on a Virtual Machine (using VM player) on a Laptop • 64-bit Intel 8 core CPU • 16 GB of physical memory • Host OS- Windows 7 64 bit Testing Environment • Postgres Plus Advanced Server v9.2 • Running on Red Hat Enterprise Linux v6.1 (with kernel version 2.6)
  • 5. Disclaimer • Performance without tuning and with tuning is shared here to make a point • The tests were done on a virtual environment running on a low end host machine • Scalability or raw performance numbers presented here are not true indicators of capabilities of PostgreSQL/Postgres Plus Advanced Server • With the real server class machines these numbers would be much higher than on the test machine
  • 6. Low Configuration PostgreSQL server scaling with Connection Pooling Database Parameters: • No of Processors: 1 • Memory: 3GB, • shared_buffer: 32MB, • effective_cache_size: 128MB • work_mem=1MB Key Learning: Test 1 - The performance degrades once the load increases beyond a point [sounds familiar?] Test 2 - Session Level Connection pooling with max 50 connections in Pool - Connections aquired as needed so not much difference than first test Test 3 - Transaction Level Connection Pooling with 25 connections - Does well as concurrency increases [scaling with growth!!!] Inconsistent/low and highs can be attributed to resources contention during autovacuum
  • 7. Some Important Parameters for Tuning in PostgreSQL • shared_buffer • effective_cache_size • work_mem • wal_buffer • bgwriter_delay • effective_io_concurrency • checkpoint_segment • checkpoint_timeout • random_page_cost • autovacuum_naptime • autovacuum_vacuum_threshold • autovacuum_analyze_threshold • autovacuum_vacuum_scale_factor • autovacuum_analyze_scale_factor • autovacuum_vacuum_cost_delay
  • 8. PostgreSQL Performs better after Tuning Database Parameters: • No of Processors: 1 • Memory: 3GB, • shared_buffer: 32MB/256MB, • effective_cache_size: 128MB/750MB • work_mem=1MB Key Learning: Test 1: Basic Setup - The performance degrades once the load increases beyond a point [sounds familiar?] Test 2: Tuned postgresql.conf for shared_buffer and effective_cache_size - Up to 19% gain over basic configuration Test 3: Tuned other parameters in postgresql.conf - Up to 21% gain - The occasional performance troughs because of vacuum operation is not there anymore Still the performance is not scalable in any of the 3 cases and degrades with concurrency [25- 30% loss]
  • 9. Combining the Effect of Connection Pooling and Tuning Database Parameters: • No of Processors: 1 • Memory: 3GB, • shared_buffer: 256MB, • effective_cache_size: 750MB • work_mem=1MB Key Learning: Test 1: Basic Setup with tuned shared_buffer and effective_cache_size - The performance degrades once the load increases beyond a point [sounds familiar?] Test 2: Tuned other parameters in postgresql.conf - Performance gain of up to 14% - The performance continues to degrade [by a margin of 26%] at higher concurrency Test 3: Transaction Level Connection Pooling - Performance is more consistent - Degradation/loss in performance at peak concurrency is quite less [14% only] Finally we get a consistently scaling Database Setup
  • 10. Tuning and proper Transaction Management enhances the benefit of CPU addition Database Parameters: • No of Processors: 2 • Memory: 3GB, • shared_buffer: 256MB, • effective_cache_size: 750MB • work_mem=1MB Key Learning: Test 1: Basic Setup with tuned shared_buffer and effective_cache_size - The performance degrades once the load increases beyond a point Test 2: Tuned other parameters in postgresql.conf - Performance gain of 36% at Peak load - The performance continues to degrade [by a margin of 26%] at higher concurrency Test 3: Transaction Level Connection Pooling - Performance is more consistent - Improvement caused by tuning is more prominent with boosted computing [1CPU- 46% | 2CPU- 80%] Even after boosting computing power, to get best of resources, tuning and connection pooling plays a major role
  • 11. Tuning and proper Transaction Management enhances the benefit of Memory Upgrade Database Parameters: • No of Processors: 2 • Memory: 4.5GB, • shared_buffer: 750MB, • effective_cache_size: 2GB • work_mem=1MB Key Learning: Test 1: Basic Setup with tuned shared_buffer[750MB] and effective_cache_size[2GB] - The performance degrades once the load increases beyond a point Test 2: Tuned other parameters in postgresql.conf - Performance gain of 55% at Peak load - The performance continues to degrade [by a margin of 15%] at higher concurrency Test 3: Transaction Level Connection Pooling - Performance is more consistent - Gain with additional memory is more prominent after tuning and connection pooling To make best use of added memory tuning and connection pooling are important
  • 12. Low Memory Tuned Postgres Vs Un-Tuned Postgres with Higher Memory Database Parameters: • No of Processors: 2 • Memory: 3GB/4.5GB, • shared_buffer: 256MB/750MB, • effective_cache_size: 750MB/2GB • work_mem=1MB Key Learning: Test 1: Un-tuned PostgreSQL [only shared_buffer and effective_cache_size is tuned] with 4.5 GB RAM - The performance continues to degrade [by a margin of 38%] at higher concurrency Test 3: Tune PostgreSQL with Transaction Level Connection Pooling - Performance is more consistent - Despite low memory, performance is comparable at low concurrency - A Tuned database with proper transaction management does better as load increases Most of your performance issues can be resolved with proper application and database tuning
  • 13. Ashnik Message • You don’t always need a high end system in the beginning to scale in future • There are commercially supported Open Source Solutions available which scale as good as their proprietary counterparts • There is no generic core-memory formula- Our consultants help customers identify what is best for them • A well designed application with a well tuned database can work better than a un-optimized database on a high end server
  • 14. How Ashnik Helps? Server sizing Health Check contracts on half yearly and annual terms On-demand Health Check and Tuning services Provide in migration services- $$ Saving by migrating from costly proprietary database solutions