You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,7 +21,7 @@ When using PostgreSQL, establishing a connection to the database involves creati
21
21
22
22
To mitigate this issue, connection pooling is used to create a cache of connections that can be reused in PostgreSQL. When an application or client requests a connection, it's created from the connection pool. After the session or transaction is completed, the connection is returned to the pool for reuse. By reusing connections, resources usage is reduced, and performance is improved.
23
23
24
-
:::image type="content" source="./media/concepts-connection-pooling-best-practices/connection-patterns.png" alt-text="Diagram for Connection Pooling Patterns":::
24
+
:::image type="content" source="./media/concepts-connection-pooling-best-practices/connection-patterns.png" alt-text="Diagram for Connection Pooling Patterns.":::
25
25
26
26
Although there are different tools for connection pooling, in this section, we discuss different strategies to use connection pooling using **PgBouncer**.
27
27
@@ -35,22 +35,22 @@ Although there are different tools for connection pooling, in this section, we d
35
35
36
36
The effective utilization of PgBouncer can be categorized into three distinct usage patterns.
Each of these patterns has its own advantages & disadvantages.
44
44
45
-
## 1. PgBouncer and Application Colocation Deployment
45
+
## 1. PgBouncer and application colocation Deployment
46
46
47
47
When utilizing this approach, PgBouncer is deployed on the same server where your application is hosted. The application & PgBouncer can be deployed either on traditional virtual machines or within a microservices-based architecture as highlighted:
48
48
49
49
### I. PgBouncer deployed in Application VM
50
50
51
51
If your application runs on an Azure VM, you can set up PgBouncer on the same VM. To install and configure PgBouncer as a connection pooling proxy with Azure Database for PostgreSQL, follow the instructions provided in the following [link](https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/steps-to-install-and-setup-pgbouncer-connection-pooling-proxy/ba-p/730555).
52
52
53
-
:::image type="content" source="./media/concepts-connection-pooling-best-practices/co-location.png" alt-text="Diagram for App co-location on VM":::
53
+
:::image type="content" source="./media/concepts-connection-pooling-best-practices/co-location.png" alt-text="Diagram for App co-location on VM.":::
54
54
55
55
56
56
Deploying PgBouncer in an application server can provide several advantages, especially when working with PostgreSQL databases. Some of the key benefits & limitations of this deployment method are:
@@ -82,7 +82,7 @@ Microsoft has published a [**PgBouncer** sidecar proxy image](https://hub.docker
82
82
83
83
Refer [this](https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/steps-to-install-and-setup-pgbouncer-connection-pooling-on-azure/ba-p/3633043) for more details.
84
84
85
-
:::image type="content" source="./media/concepts-connection-pooling-best-practices/sidecar-proxy.png" alt-text="Diagram for App co-location on Sidecar":::
85
+
:::image type="content" source="./media/concepts-connection-pooling-best-practices/sidecar-proxy.png" alt-text="Diagram for App co-location on Sidecar.":::
86
86
87
87
Some of the key benefits & limitations of this deployment method are:
88
88
@@ -102,7 +102,7 @@ By considering PgBouncer as an AKS sidecar, you can use these advantages to enha
102
102
103
103
While considering this sidecar pattern, it's crucial to carefully assess the trade-offs between deployment complexity and scalability requirements to determine the most appropriate approach for your specific application scenario.
When utilizing this approach, PgBouncer is deployed as a centralized service, independent of the application. The PgBouncer service can be deployed either on traditional virtual machines or within a microservices-based architecture as highlighted:
108
108
@@ -113,7 +113,7 @@ When utilizing this approach, PgBouncer is deployed as a centralized service, in
113
113
Refer [link](https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/steps-to-install-and-setup-pgbouncer-connection-pooling-proxy/ba-p/730555) to install and set up PgBouncer connection pooling proxy with Azure Database for PostgreSQL.
114
114
115
115
116
-
:::image type="content" source="./media/concepts-connection-pooling-best-practices/deploying-vm.png" alt-text="Diagram for App co-location on Vm with Load Balancer":::
116
+
:::image type="content" source="./media/concepts-connection-pooling-best-practices/deploying-vm.png" alt-text="Diagram for App co-location on Vm with Load Balancer.":::
117
117
118
118
Some of the key benefits & limitations of this deployment method are:
119
119
@@ -132,15 +132,15 @@ By considering these benefits, deploying PgBouncer on a VM offers a convenient a
132
132
-**Management overhead:** As **PgBouncer** is installed in VM, there might be management overhead to manage multiple configuration files. This makes it difficult to cope up with version upgrades, new releases, and product updates.
133
133
-**Feature parity:** If you're migrating from traditional PostgreSQL to Azure PostgreSQL and using **PgBouncer**, there might be some features gaps. For example, lack of md5 support in Azure PostgreSQL.
134
134
135
-
### II. Centralized PgBouncer Deployed as a service within AKS
135
+
### II. Centralized PgBouncer deployed as a service within AKS
136
136
137
137
If you're working with highly scalable and large containerized deployments on Azure Kubernetes Service (AKS), consisting of hundreds of pods, or in situations where multiple applications need to connect to a shared database, **PgBouncer** can be employed as a standalone service rather than a sidecar container.
138
138
139
139
By utilizing **PgBouncer** as a separate service, you can efficiently manage and handle connection pooling for your applications on a broader scale. This approach allows for centralizing the connection pooling functionality, enabling multiple applications to connect to the same database resource while maintaining optimal performance and resource utilization.
140
140
141
141
[**PgBouncer** sidecar proxy image](https://hub.docker.com/_/microsoft-azure-oss-db-tools-pgbouncer-sidecar) published in Microsoft container registry can be used to create and deploy a service.
142
142
143
-
:::image type="content" source="./media/concepts-connection-pooling-best-practices/centralized-aks.png" alt-text="Diagram for PgBouncer as a service within AKS":::
143
+
:::image type="content" source="./media/concepts-connection-pooling-best-practices/centralized-aks.png" alt-text="Diagram for PgBouncer as a service within AKS.":::
144
144
145
145
Some of the key benefits & limitations of this deployment method are:
0 commit comments