Loading Now

Running high-performance PostgreSQL on Azure Kubernetes Service

PostgreSQL is proving itself as a preferred database for workloads operating on Kubernetes, continually enhancing its reputation in the tech community.

<p class="wp-block-paragraph">In the dynamic realm of cloud-native technologies, <a href="https://www.postgresql.org/" target="_blank" rel="noreferrer noopener">PostgreSQL</a> has cemented its status as a leading database solution for Kubernetes. The <em>Kubernetes in the Wild 2025 report</em> highlights that PostgreSQL now supports 36% of all database workloads on Kubernetes, a 6% increase since 2022. This growth marks its increasing acceptance and reliability among Kubernetes users<sup>1</sup>. However, managing data-intensive PostgreSQL workloads on Kubernetes presents challenges. These include overseeing Kubernetes components like StatefulSets and deployments, as well as optimising performance through careful configuration of storage, replication, and database settings. Fortunately, the process is becoming more streamlined.</p>

<p class="wp-block-paragraph">We now offer two options for deploying stateful PostgreSQL workloads tailored to different performance requirements. For databases requiring low latency and scalability, you can utilise <a href="https://learn.microsoft.com/en-us/azure/storage/container-storage/container-storage-introduction" target="_blank" rel="noreferrer noopener">Azure Container Storage</a> to orchestrate Kubernetes volume deployment directly on local NVMe, providing increased IOPS while maintaining sub-millisecond latency. On the other hand, if you’re looking for an optimal balance of price and performance, <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types#premium-ssd-v2" target="_blank" rel="noreferrer noopener">Premium SSD v2</a> is your best option. Additionally, by partnering with <a href="https://cloudnative-pg.io/" target="_blank" rel="noreferrer noopener">CloudNativePG</a>, we’ve developed a robust open-source operator for PostgreSQL, which supports a high-availability deployment model on Azure Kubernetes Service (AKS). Combining our advanced storage options with CloudNativePG elevates AKS to a powerful platform for high-performance PostgreSQL workloads.</p>

<h2 class="wp-block-heading" id="breakthrough-postgresql-performance-with-local-nvme">Unleash PostgreSQL Performance with Local NVMe</h2>

<p class="wp-block-paragraph">For PostgreSQL workloads that are performance-critical, like high-volume transactions or those needing rapid data access, using <strong>local NVMe</strong> directly attached to Azure Virtual Machine (VM) SKUs is ideal. In the past, utilising local NVMe drives in Kubernetes could be cumbersome—it often meant setting up RAID across the drives and manually managing static volume orchestrators. However, <strong>Azure Container Storage simplifies this process</strong>.</p>

<p class="wp-block-paragraph"><strong>Azure Container Storage</strong> is a fully managed storage solution tailored for containers. Developers can easily request a Kubernetes volume, and Azure will automatically provision storage using the local NVMe drives available on AKS nodes. This means that PostgreSQL users can enjoy the benefits of direct attach block storage with optimised IOPS and latency all within a managed cloud environment. Whether you’re powering payment platforms, gaming backends, or real-time customisation engines, you can experience both speed and ease of use. Azure Container Storage is also compatible with <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview" target="_blank" rel="noreferrer noopener"><strong>Azure Disk</strong></a> and <strong>Elastic SAN (Preview)</strong>, allowing you to select storage options with varying levels of durability, scale, or cost as your needs change—all within a single Kubernetes-native management interface.</p>

<p class="wp-block-paragraph">Our benchmarking results show PostgreSQL achieving nearly 15,000 transactions per second (TPS) with an average latency of under 5 milliseconds using the Standard_L16s_v3 VM. When we increased to larger VM sizes like Standard_L64s_v3, TPS soared to 26,000, all while keeping low latency. For more insights into our benchmarks, check the <strong>comparison of storage options section</strong> below.</p>

<h2 class="wp-block-heading" id="optimize-price-performance-with-premium-ssd-v2">Maximise Price-Performance with Premium SSD v2</h2>

<p class="wp-block-paragraph"><a href="https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types#premium-ssd-v2" target="_blank" rel="noreferrer noopener"><strong>Azure Premium SSD v2</strong></a> strikes an excellent balance between cost and performance, making it particularly suitable for production settings that may need scalability over time. With Premium SSD v2, you can independently configure <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/disks-deploy-premium-v2?tabs=azure-cli#adjust-disk-performance" target="_blank" rel="noreferrer noopener">IOPS, throughput, and size</a>, allowing PostgreSQL deployments to adapt to demand without incurring unnecessary costs.</p>

<p class="wp-block-paragraph">Whether you’re managing multi-tenant SaaS platforms, production systems that expand alongside your business, or apps experiencing spikes in traffic, this flexibility translates into <strong>real savings without compromising performance</strong>. Premium SSD v2 supports up to <strong>80,000 IOPS</strong> and <strong>1,200 MB/s</strong> per volume, catering to even the most demanding PostgreSQL workloads while dynamically adjusting to meet your application’s requirements.</p>

<h2 class="wp-block-heading" id="comparison-of-storage-options">Comparison of Storage Options</h2>

<p class="wp-block-paragraph">To assist in evaluating the storage options presented earlier, we conducted benchmark tests using CloudNativePG operator setups on AKS, keeping core and memory usage consistent while varying the storage backing: one option used local NVMe with Azure Container Storage, and the other relied on Premium SSD v2 with Disk CSI driver.</p>

<p class="wp-block-paragraph">For our first setup, we employed the Standard_D16d_v5 SKU and prepared two Premium SSD v2 32 GiB disks, each offering 3000 IOPS and 125 MB/s throughput for log and data storage. In the second configuration, we operated on Standard_L16s_v3 nodes equipped with local NVMe storage. The test setup closely mirrored a real-world production database environment. TPS measures the number of transactions (like INSERT, UPDATE, DELETE, or SELECT) a system can conduct each second, while latency is the time delay from sending a request to the database to receiving a reply. This is especially crucial for applications needing real-time or near-real-time responsiveness, like financial systems, online gaming, or high-performance analytics.</p>

<figure class="wp-block-image aligncenter size-full"><img decoding="async" alt="Performance comparison chart for PostgreSQL, highlighting the best options for cost and efficiency." class="wp-image-44711 webp-format"  src="https://azure.microsoft.com/en-us/blog/wp-content/uploads/2025/07/performance-comparison-chart-pv2-and-local-nvme.webp"/></figure>

<p class="wp-block-paragraph">Local NVMe on Standard_L16s_v3 achieved <strong>14,812 TPS</strong> with an <strong>average latency of 4.321 milliseconds</strong>. Meanwhile, using PremiumV2_LRS on Standard_D16ds_v5 marked <strong>8,600 TPS at 7.417 milliseconds latency</strong>. You can check the price comparisons below:</p>

<figure class="wp-block-image aligncenter size-large"><img decoding="async" alt="Price comparison table showcasing Premium SSD v2 versus Local NVMe with Azure Container Storage." class="wp-image-44836 webp-format"  src="https://azure.microsoft.com/en-us/blog/wp-content/uploads/2025/07/Price-comparison-table-1-1024x347.webp"/></figure>

<p class="has-small-font-size wp-block-paragraph"><em>*Monthly costs are based on a standard provision of 3000 IOPS and 125 MB/s throughput. You can adjust the performance metrics, such as capacity, throughput, and IOPS, of Premium SSD v2 disks whenever required, allowing workloads to maintain cost efficiency while meeting performance expectations.</em></p>

<p class="has-small-font-size wp-block-paragraph"><em>**With three VMs of L16s_v3, you’re provided with 11.52 TB of default allocated storage for PostgreSQL workloads. Costs and storage allocation may vary for other VM sizes in the L-Series family.</em></p>

<p class="wp-block-paragraph">When deciding between local NVMe and Premium SSD v2 for PostgreSQL workloads, it's essential to consider the balance between performance, cost, and data durability. Local NVMe through Azure Container Storage provides exceptionally low latency and high throughput, making it ideal for performance-sensitive PostgreSQL implementations. While costs may be higher, there’s less flexibility for scaling independently of workload characteristics. On the flip side, Premium SSD v2 offers greater price-performance ratio and flexible scalability, making it well-suited for PostgreSQL instances that need to manage increased loads or navigate unpredictable demand surges. Regarding data durability, Premium SSD v2 typically comes with local redundancy, whereas for local NVMe, it is advisable to implement a <a href="https://learn.microsoft.com/en-us/azure/aks/postgresql-ha-overview#deployment-architecture" target="_blank" rel="noreferrer noopener">replica architecture managed by the CloudNativePG operator</a> combined with an object storage backup strategy to prevent data loss.</p>

<h2 class="wp-block-heading" id="built-for-high-availability-with-cloudnativepg-on-azure-kubernetes-service">Designed for High Availability with CloudNativePG on Azure Kubernetes Service</h2>

<p class="wp-block-paragraph">For teams implementing PostgreSQL in production, <strong>high availability and backup solutions are essential</strong>. With the open-source CloudNativePG operator, deploying a highly available PostgreSQL cluster on AKS is straightforward, featuring:</p>

<ul class="wp-block-list">
    <li class="wp-block-list-item">Built-in <strong>replication and automated failover</strong>.</li>
    <li class="wp-block-list-item">Application-consistent <strong>backups with seamless Azure Blob Storage integration</strong>.</li>
    <li class="wp-block-list-item">Smooth coordination with <strong>Azure Container Storage</strong>.</li>
    <li class="wp-block-list-item">Versatile storage options: <strong>choose between Premium SSD v2 or local NVMe based on your workload</strong>.</li>
</ul>

<p class="wp-block-paragraph">Whether you’re managing internal business applications or customer-facing services, this setup gives you <strong>peace of mind </strong> without the need for cumbersome custom high availability configurations or separate backup systems. Begin your journey to deploying a high-availability PostgreSQL setup on AKS with CloudNativePG operator by following our <a href="https://learn.microsoft.com/en-us/azure/aks/deploy-postgresql-ha?tabs=azuredisk" target="_blank" rel="noreferrer noopener">step-by-step reference guide</a>.</p>

<h2 class="wp-block-heading" id="ready-for-the-future">Prepared for the Future</h2>

<p class="wp-block-paragraph">PostgreSQL is just one of several stateful workloads that businesses confidently run on Azure Kubernetes Service today. From <strong>databases</strong> to <strong>message queues</strong>, <strong>AI inferencing</strong>, and <strong>enterprise applications</strong>, AKS is adapting to cater to the needs of data-intensive apps in live environments.</p>

<p class="wp-block-paragraph">Whether you’re deploying <a href="https://techcommunity.microsoft.com/blog/appsonazureblog/run-scalable-and-resilient-redis-with-kubernetes-and-azure-kubernetes-service/3247956" target="_blank" rel="noreferrer noopener"><strong>Redis</strong></a>, <a href="https://learn.microsoft.com/en-us/azure/aks/mongodb-overview" target="_blank" rel="noreferrer noopener"><strong>MongoDB</strong></a>, <a href="https://learn.microsoft.com/en-us/azure/aks/kafka-overview" target="_blank" rel="noreferrer noopener"><strong>Kafka</strong></a>, or even <a href="https://learn.microsoft.com/en-us/azure/aks/use-flyte" target="_blank" rel="noreferrer noopener"><strong>ML-serving pipelines</strong></a> with GPU-enabled nodes, AKS delivers a robust foundation for managing these workloads while ensuring performance, consistency, and ease of operation, alongside clear guidance from end to end.</p>

<p class="wp-block-paragraph">With advancements like Azure Container Storage for local NVMe and Premium SSD v2 for scalable persistent storage, we’re simplifying the creation of stateful applications that are reliable, high-performing, and cost-effective for essential workloads.</p>

<p class="wp-block-paragraph">Modernise your data management on Kubernetes today. Whether you're working with PostgreSQL or any stateful layer, Azure offers the performance and management capabilities you need. Explore effective deployment patterns and strategies in the <a href="https://learn.microsoft.com/en-us/azure/aks/stateful-workloads-overview" target="_blank" rel="noreferrer noopener">AKS Stateful Workloads Overview</a>.</p>

<hr class="wp-block-separator has-alpha-channel-opacity"/>

<p class="wp-block-paragraph"><sup>1</sup><a href="https://www.dynatrace.com/resources/ebooks/kubernetes-in-the-wild/" target="_blank" rel="noreferrer noopener"><em>Kubernetes in the Wild 2025 report</em></a></p>