SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
MONGODB vs POSTGRESQL BENCHMARKS
MONGODB vs POSTGRESQL
BENCHMARKS
Álvaro Hernández
MONGODB vs POSTGRESQL BENCHMARKS
`whoami`
Álvaro Hernández <aht@ongres.com>
@ahachete
● Founder & CEO, OnGres
● 20+ years PostgreSQL user and DBA
● Mostly doing R&D to create new, innovative
software on Postgres
● Frequent speaker at PostgreSQL, database
conferences
● Principal Architect of ToroDB
● Founder and President of the NPO
Fundación PostgreSQL
MONGODB vs POSTGRESQL BENCHMARKS
Introduction
MONGODB vs POSTGRESQL BENCHMARKS
OnGres Ethics Policy
This work was sponsored by EnterpriseDB, and performed by OnGres.
It was conducted according to OnGres Ethics Policy, that observes that:
● All the work is conducted with the maximum degree of professionalism
and independence.
● No technology is favored over another.
● No results are edited or omitted.
● The sponsor of the work does not intervene in the strategy,
implementation or execution of the work.
● Results are verifiable by external, third parties.
MONGODB vs POSTGRESQL BENCHMARKS
Benchmarking is hard
● Bench-marketing is easy --but not trustable.
● Benchmarking is hard.
● Benchmarking databases is harder.
● Benchmarking databases that follow different design models, is
even harder.
● Are MongoDB and PostgreSQL comparable?
● The market demands this: informed decision, performance is key.
MONGODB vs POSTGRESQL BENCHMARKS
Pursuing benchmarking fairness
How to present a fair arena in which the technologies compete in an
apples-to-apples scenario?
● Transparency and reproducibility. Infrastructure-as-Code.
https://gitlab.com/ongresinc/benchplatform/
https://gitlab.com/ongresinc/txbenchmark/
http://benchplatform.ongres.com.s3.amazonaws.com/
● Multiple benchmarks
● Close-to-real workloads
● Production-grade setups
MONGODB vs POSTGRESQL BENCHMARKS
Types of benchmarks
Three main benchmark categories:
● Transactions benchmark
● OLTP
○ In-memory dataset (4GB)
○ Larger, on-disk dataset (2TB)
● OLAP
MONGODB vs POSTGRESQL BENCHMARKS
The contenders
MongoDB 4.0
● Community version used
● Journaling active
● Replication active
(single node)
● No further tuning required
PostgreSQL 11
● Self-managed instance
● Basic production tuning
● Tested w/ and w/o
PgBouncer
MONGODB vs POSTGRESQL BENCHMARKS
Architecture: client-server, running on AWS
Data volume: io1, with number of reserved IOPS depending on the test.
MONGODB vs POSTGRESQL BENCHMARKS
Benchmarks:
Transactions
MONGODB vs POSTGRESQL BENCHMARKS
Previous discussion: isolation levels
MONGODB vs POSTGRESQL BENCHMARKS
Benchmark description
● Custom-developed benchmark.
● Inspired by MongoDB post about MongoDB transactions.
● Simulates air reservation system: check flight schedule, plane
availability, purchase, audit log.
● Tx with query, insertions and upsert.
● Programmed in Java. Official JDBC and MongoDB drivers.
● Open source: https://gitlab.com/ongresinc/benchplatform
MONGODB vs POSTGRESQL BENCHMARKS
Transaction performance
MONGODB vs POSTGRESQL BENCHMARKS
Transaction performance
MONGODB vs POSTGRESQL BENCHMARKS
Transaction retries
MONGODB vs POSTGRESQL BENCHMARKS
PostgreSQL latency (@ SERIALIZABLE)
MONGODB vs POSTGRESQL BENCHMARKS
MongoDB latency
MONGODB vs POSTGRESQL BENCHMARKS
Benchmarks:
OLTP
MONGODB vs POSTGRESQL BENCHMARKS
Benchmark description
● Industry standard Sysbench was used.
● Supports PostgreSQL and MongoDB (via sysbench-mongodb-lua).
● Resembles real-world OLTP workload.
● Different dimensions benchmarked:
○ Dataset size: fit in memory (4GB), on-disk (2TB)
○ Read/write work split: 50/50, 95/5.
○ Filesystems: XFS or ZFS.
○ Different levels of concurrency.
MONGODB vs POSTGRESQL BENCHMARKS
Discussion about PostgreSQL Connection Pooling
● PostgreSQL best practice is to run always behind a connection pool.
● PostgreSQL proved to be highly sensitive to the number of connections,
with degraded performance when overwhelmed.
● A connection pool offers close-to-ideal performance for almost any
workload.
● MongoDB does not require connection pooling:
is included in drivers.
MONGODB vs POSTGRESQL BENCHMARKS
Performance: dataset in memory
MONGODB vs POSTGRESQL BENCHMARKS
PG connection pooling effect (dataset in memory)
MONGODB vs POSTGRESQL BENCHMARKS
Performance: dataset on disk
MONGODB vs POSTGRESQL BENCHMARKS
Benchmarks:
OLAP
MONGODB vs POSTGRESQL BENCHMARKS
Benchmark description
● JSON dataset (GitHub Archive). Native to MongoDB, jsonb in PG.
● 2015 dataset: 212M records (340GB on PG, 206GB on MongoDB).
● Timing of OLAP-style queries that resemble BI natural questions:
○ Repositories ordered by most opened issues.
○ Most frequent git event types, ordered.
○ Top 10 most active actors.
○ Repositories that have more than two comments and a specific
event type, ordered.
MONGODB vs POSTGRESQL BENCHMARKS
Query A in PostgreSQL and MongoDB
MONGODB vs POSTGRESQL BENCHMARKS
Results
MONGODB vs POSTGRESQL BENCHMARKS
QUESTIONS?
Álvaro Hernández
<aht@ongres.com>
@ahachete / www.ongres.com
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
DataWorks Summit
 

Was ist angesagt? (20)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache Pinot
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guide
 
Hardening Kafka Replication
Hardening Kafka Replication Hardening Kafka Replication
Hardening Kafka Replication
 
Building large scale transactional data lake using apache hudi
Building large scale transactional data lake using apache hudiBuilding large scale transactional data lake using apache hudi
Building large scale transactional data lake using apache hudi
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
 
Apache Spark Architecture
Apache Spark ArchitectureApache Spark Architecture
Apache Spark Architecture
 
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic Datasets
 
Logstash
LogstashLogstash
Logstash
 
High-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQLHigh-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQL
 
Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...
Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...
Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...
 
Druid
DruidDruid
Druid
 
Facebook Messages & HBase
Facebook Messages & HBaseFacebook Messages & HBase
Facebook Messages & HBase
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Thanos: Global, durable Prometheus monitoring
Thanos: Global, durable Prometheus monitoringThanos: Global, durable Prometheus monitoring
Thanos: Global, durable Prometheus monitoring
 
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 

Ähnlich wie MongoDB vs. Postgres Benchmarks

kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
Krivoy Rog IT Community
 
Benchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetesBenchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetes
DoKC
 

Ähnlich wie MongoDB vs. Postgres Benchmarks (20)

PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Toro DB- Open-source, MongoDB-compatible database, built on top of PostgreSQL
Toro DB- Open-source, MongoDB-compatible database,  built on top of PostgreSQLToro DB- Open-source, MongoDB-compatible database,  built on top of PostgreSQL
Toro DB- Open-source, MongoDB-compatible database, built on top of PostgreSQL
 
MongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL DatabaseMongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL Database
 
An evening with Postgresql
An evening with PostgresqlAn evening with Postgresql
An evening with Postgresql
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
MongoDB Online Training.pdf
MongoDB Online Training.pdfMongoDB Online Training.pdf
MongoDB Online Training.pdf
 
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
 
Benchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetesBenchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetes
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
Mongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded DatabasesMongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded Databases
 
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
 
Mongodb (1)
Mongodb (1)Mongodb (1)
Mongodb (1)
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
 
Graphs, parallelism and business cases
 Graphs, parallelism and business cases Graphs, parallelism and business cases
Graphs, parallelism and business cases
 
Graphs, parallelism and business cases
Graphs, parallelism and business casesGraphs, parallelism and business cases
Graphs, parallelism and business cases
 
Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)
 
Quick overview on mongo db
Quick overview on mongo dbQuick overview on mongo db
Quick overview on mongo db
 

Mehr von EDB

EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021
EDB
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?
EDB
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
EDB
 

Mehr von EDB (20)

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQL
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQL
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQL
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with Postgres
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQL
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJ
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos données
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - Italiano
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJ
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

MongoDB vs. Postgres Benchmarks

  • 1. MONGODB vs POSTGRESQL BENCHMARKS MONGODB vs POSTGRESQL BENCHMARKS Álvaro Hernández
  • 2. MONGODB vs POSTGRESQL BENCHMARKS `whoami` Álvaro Hernández <aht@ongres.com> @ahachete ● Founder & CEO, OnGres ● 20+ years PostgreSQL user and DBA ● Mostly doing R&D to create new, innovative software on Postgres ● Frequent speaker at PostgreSQL, database conferences ● Principal Architect of ToroDB ● Founder and President of the NPO Fundación PostgreSQL
  • 3. MONGODB vs POSTGRESQL BENCHMARKS Introduction
  • 4. MONGODB vs POSTGRESQL BENCHMARKS OnGres Ethics Policy This work was sponsored by EnterpriseDB, and performed by OnGres. It was conducted according to OnGres Ethics Policy, that observes that: ● All the work is conducted with the maximum degree of professionalism and independence. ● No technology is favored over another. ● No results are edited or omitted. ● The sponsor of the work does not intervene in the strategy, implementation or execution of the work. ● Results are verifiable by external, third parties.
  • 5. MONGODB vs POSTGRESQL BENCHMARKS Benchmarking is hard ● Bench-marketing is easy --but not trustable. ● Benchmarking is hard. ● Benchmarking databases is harder. ● Benchmarking databases that follow different design models, is even harder. ● Are MongoDB and PostgreSQL comparable? ● The market demands this: informed decision, performance is key.
  • 6. MONGODB vs POSTGRESQL BENCHMARKS Pursuing benchmarking fairness How to present a fair arena in which the technologies compete in an apples-to-apples scenario? ● Transparency and reproducibility. Infrastructure-as-Code. https://gitlab.com/ongresinc/benchplatform/ https://gitlab.com/ongresinc/txbenchmark/ http://benchplatform.ongres.com.s3.amazonaws.com/ ● Multiple benchmarks ● Close-to-real workloads ● Production-grade setups
  • 7. MONGODB vs POSTGRESQL BENCHMARKS Types of benchmarks Three main benchmark categories: ● Transactions benchmark ● OLTP ○ In-memory dataset (4GB) ○ Larger, on-disk dataset (2TB) ● OLAP
  • 8. MONGODB vs POSTGRESQL BENCHMARKS The contenders MongoDB 4.0 ● Community version used ● Journaling active ● Replication active (single node) ● No further tuning required PostgreSQL 11 ● Self-managed instance ● Basic production tuning ● Tested w/ and w/o PgBouncer
  • 9. MONGODB vs POSTGRESQL BENCHMARKS Architecture: client-server, running on AWS Data volume: io1, with number of reserved IOPS depending on the test.
  • 10. MONGODB vs POSTGRESQL BENCHMARKS Benchmarks: Transactions
  • 11. MONGODB vs POSTGRESQL BENCHMARKS Previous discussion: isolation levels
  • 12. MONGODB vs POSTGRESQL BENCHMARKS Benchmark description ● Custom-developed benchmark. ● Inspired by MongoDB post about MongoDB transactions. ● Simulates air reservation system: check flight schedule, plane availability, purchase, audit log. ● Tx with query, insertions and upsert. ● Programmed in Java. Official JDBC and MongoDB drivers. ● Open source: https://gitlab.com/ongresinc/benchplatform
  • 13. MONGODB vs POSTGRESQL BENCHMARKS Transaction performance
  • 14. MONGODB vs POSTGRESQL BENCHMARKS Transaction performance
  • 15. MONGODB vs POSTGRESQL BENCHMARKS Transaction retries
  • 16. MONGODB vs POSTGRESQL BENCHMARKS PostgreSQL latency (@ SERIALIZABLE)
  • 17. MONGODB vs POSTGRESQL BENCHMARKS MongoDB latency
  • 18. MONGODB vs POSTGRESQL BENCHMARKS Benchmarks: OLTP
  • 19. MONGODB vs POSTGRESQL BENCHMARKS Benchmark description ● Industry standard Sysbench was used. ● Supports PostgreSQL and MongoDB (via sysbench-mongodb-lua). ● Resembles real-world OLTP workload. ● Different dimensions benchmarked: ○ Dataset size: fit in memory (4GB), on-disk (2TB) ○ Read/write work split: 50/50, 95/5. ○ Filesystems: XFS or ZFS. ○ Different levels of concurrency.
  • 20. MONGODB vs POSTGRESQL BENCHMARKS Discussion about PostgreSQL Connection Pooling ● PostgreSQL best practice is to run always behind a connection pool. ● PostgreSQL proved to be highly sensitive to the number of connections, with degraded performance when overwhelmed. ● A connection pool offers close-to-ideal performance for almost any workload. ● MongoDB does not require connection pooling: is included in drivers.
  • 21. MONGODB vs POSTGRESQL BENCHMARKS Performance: dataset in memory
  • 22. MONGODB vs POSTGRESQL BENCHMARKS PG connection pooling effect (dataset in memory)
  • 23. MONGODB vs POSTGRESQL BENCHMARKS Performance: dataset on disk
  • 24. MONGODB vs POSTGRESQL BENCHMARKS Benchmarks: OLAP
  • 25. MONGODB vs POSTGRESQL BENCHMARKS Benchmark description ● JSON dataset (GitHub Archive). Native to MongoDB, jsonb in PG. ● 2015 dataset: 212M records (340GB on PG, 206GB on MongoDB). ● Timing of OLAP-style queries that resemble BI natural questions: ○ Repositories ordered by most opened issues. ○ Most frequent git event types, ordered. ○ Top 10 most active actors. ○ Repositories that have more than two comments and a specific event type, ordered.
  • 26. MONGODB vs POSTGRESQL BENCHMARKS Query A in PostgreSQL and MongoDB
  • 27. MONGODB vs POSTGRESQL BENCHMARKS Results
  • 28. MONGODB vs POSTGRESQL BENCHMARKS QUESTIONS? Álvaro Hernández <aht@ongres.com> @ahachete / www.ongres.com Thank you