Name | ident | parent | level | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes To start, we can calculate how much memory is used by our current connection in total: Have you ever been curious why a certain Postgres connection is taking up a higher amount of memory? With the new pg_backend_memory_contexts view you can take a close look at what exactly is allocated for a given Postgres process. Dive into memory use with pg_backend_memory_contexts You can find all the details in Andres Freund's original post introducing these improvements. The query went from 15,000 TPS to almost 35,000 TPS - that's over 2x better than in Postgres 13. The original author of this work, Andres Freund, ran a benchmark on the throughput of a single active query, whilst also running 10,000 idle connections. Now, most workloads don't actually have this many active connections, but rather a high number of idle connections. Note that you will usually see a noticeable TPS drop when the number of connections exceeds the number of CPUs, this is most likely due to CPU scheduling overhead, and not a limitation in Postgres itself. At 10,000 active connections the improvement is 50% over Postgres 13, and at lower connection counts you can also see consistent improvements. Tps = 495108.316805 (without initial connection time)Īs you can see, the throughput of Postgres 14 at 5000 active connections is about 20% higher. To start, we initialize the database with pgbench scale factor 200: ![]() We use pgbench to test connection scaling of active connections. Both of these use Ubuntu 20.04, with the default system settings, but the Postgres connection limit has been increased to 11,000 connections. With this new release, scaling active and idle connections has gotten significantly better, and will be a major improvement for the most demanding applications.įor our test, we've used two 96 vCore AWS instances (c5.24xlarge), one running Postgres 13.3, and one running Postgres 14 beta1. This has some important benefits, but it also has overhead at large connection counts. The Postgres connection model relies on processes instead of threads. Postgres 14 brings significant improvements for those of us that need a high number of database connections. Improved Active and Idle Connection Scaling in Postgres 14 And 200+ other improvements in the Postgres 14 release!.Monitor queries with the built-in Postgres query_id.Dive into memory use with pg_backend_memory_contexts.Improved Active and Idle Connection Scaling in Postgres 14.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |