Home
%3CLINGO-SUB%20id%3D%22lingo-sub-772706%22%20slang%3D%22en-US%22%3EPerformance%20Considerations%20and%20Expectations%20when%20migrating%20from%20IaaS%20or%20on-prem%20to%20PaaS%20database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-772706%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20blog%20post%20discusses%20migrating%20from%20on-prem%20or%20IaaS%20database%20to%20an%20Azure%20Database%20for%20MySQL%20and%20Azure%20Database%20for%20PostgreSQL%20PaaS%20databases.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20migrating%20from%20an%20on-prem%20database%20server%20or%20an%20IaaS%20server%20to%20the%20PaaS%20service%20few%20things%20needs%20to%20be%20in%20mind%20in%20terms%20of%20performance%20expectations.%20Azure%20Database%20for%20PostgreSQL%20and%20Azure%20database%20for%20MySQL%20(PaaS)%20comes%20with%20a%20great%20features%20that%20reduce%20the%20manual%20management%20effort%20on%20the%20database%20servers%2C%20such%20as%20High%20availability%2C%20Automated%20Backups%2C%20Server%20Monitoring%20for%20resource%20utilization%2C%20Security%20such%20as%20encryption%2C%20Firewall%20and%20SSL%2C%20Performance%20insights%20and%20recommendations%2C%20Portal%20UI%20for%20the%20server%20management%2C%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20these%20features%20are%20maintained%20by%20background%20processes%20that%20have%20cost%20in%20terms%20of%20performance%20which%20is%20not%20the%20case%20in%20the%20Azure%20VM%20and%20the%20on-prem%20solution%2C%20This%20will%20require%20to%20setup%20the%20expectations%20that%20your%20PaaS%20server%20should%20have%20more%20resources%20horse%20power%20to%20perform%20at%20the%20same%20level%20as%20the%20on-prem%20or%20the%20IaaS%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn-prem%20servers%20will%20generally%20have%20a%20better%20performance%20compared%20to%20cloud%20based%20database%20servers%20for%20the%20above%20mentioned%20reason%20and%20for%20the%20fact%20that%20the%20on-prem%20servers%20have%20way%20less%20geographical%20distance%20between%20the%20application%20and%20the%20database%20servers%20which%20means%20less%20network%20latency.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESolution%3C%2FSTRONG%3E%3A%20Please%20consider%20the%20following%20performance%20recommendations%20and%20best%20practices%20while%20building%20your%20environment%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E1)%20Server%20resources%20specifications%3A%20%3CBR%20%2F%3E%3C%2FSTRONG%3ESet%20the%20specifications%20(number%20of%20vCores%20and%20Disk%20size)%20for%20your%20PaaS%20server%20to%20accommodate%26nbsp%3Byour%20workload%20and%20avoid%20high%20resource%20utilization.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E2)%20connection%20pooling%3CBR%20%2F%3E%3C%2FSTRONG%3EMake%20sure%20that%20the%20application%20has%20connection%20pooling%20implemented%20as%20a%20best%20practice%20to%20communicate%20with%20a%20PaaS%20database%20server.%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20take%20Azure%20Database%20for%20PostgreSQL%20as%20an%20example%3A%20servers%20establishing%20a%20connection%20is%20an%20expensive%20operation.%20This%20is%20attributed%20to%20the%20fact%20that%20each%20new%20connection%20to%20the%20PostgreSQL%20requires%20forking%20of%20the%20OS%20process%20and%20a%20new%20memory%20allocation%20for%20the%20connection.%20As%20a%20result%2C%20transnational%20applications%20frequently%20opening%20and%20closing%20the%20connections%20at%20the%20end%20of%20transactions%20can%20experience%20higher%20connection%20latency%2C%20resulting%20in%20lower%20database%20throughput%20(transactions%20per%20second)%20and%20overall%20higher%20application%20latency.%20It%20is%20therefore%20recommended%20to%20leverage%20connection%20pooling%20when%20designing%20applications%20using%20Azure%20Database%20for%20PostgreSQL.%20This%20significantly%20reduces%20connection%20latency%20by%20reusing%20existing%20connections%20and%20enables%20higher%20database%20throughput%20(transactions%20per%20second)%20on%20the%20server.%20With%20connection%20pooling%2C%20a%20fixed%20set%20of%20connections%20are%20established%20at%20the%20startup%20time%20and%20maintained.%20This%20also%20helps%20reduce%20the%20memory%20fragmentation%20on%20the%20server%20that%20is%20caused%20by%20the%20dynamic%20new%20connections%20established%20on%20the%20database%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E3)%20VMs%20with%20accelerated%20networking%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-network%2Fcreate-vm-accelerated-networking-cli%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAccelerated%20Networking%3C%2FA%3E%26nbsp%3Benables%20single%20root%20I%2FO%20virtualization%20(SR-IOV)%20to%20a%20VM%2C%20greatly%20improving%20its%20networking%20performance.%20This%20high-performance%20path%20bypasses%20the%20host%20from%20the%20datapath%2C%20reducing%20latency%2C%20jitter%2C%20and%20CPU%20utilization%2C%20for%20use%20with%20the%20most%20demanding%20network%20workloads%20on%20supported%20VM%20types.%20The%20following%20picture%20shows%20communication%20between%20two%20VMs%20with%20and%20without%20accelerated%20networking%3A%3C%2FP%3E%0A%3CP%3EWithout%20accelerated%20networking%2C%20all%20networking%20traffic%20in%20and%20out%20of%20the%20VM%20must%20traverse%20the%20host%20and%20the%20virtual%20switch.%20The%20virtual%20switch%20provides%20all%20policy%20enforcement%2C%20such%20as%20network%20security%20groups%2C%20access%20control%20lists%2C%20isolation%2C%20and%20other%20network%20virtualized%20services%20to%20network%20traffic.%20To%20learn%20more%20about%20virtual%20switches%2C%20read%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Fwindows%2Fit-pro%2Fwindows-server-2012-R2-and-2012%2Fjj134230(v%3Dws.11)%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EHyper-V%20network%20virtualization%20and%20virtual%20switch%3C%2FA%3Earticle.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20960px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124394i69E63B769219DB3B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22accelrated%20networking.jpg%22%20title%3D%22accelrated%20networking.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3E4)%20Application%20and%20Database%20servers%20in%20the%20same%20Data%20Center%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EMake%20sure%20your%20Application%20and%20database%20are%20in%20the%20same%20data%20center%2C%26nbsp%3Bapplications%20that%20access%20data%20by%20using%20high-volume%2C%20frequent%2C%20ad%20hoc%20querying%2C%20a%20substantial%20amount%20of%20response%20time%20is%20spent%20on%20network%20communication%20between%20the%20application%20tier%20and%20the%20Azure%20Database%20for%20MySQL%20and%20Azure%20Database%20for%20PostgreSQL.%20Even%20when%20both%20the%20application%20and%20Azure%20Database%20are%20in%20the%20same%20data%20center%2C%20the%20network%20latency%20between%20the%20two%20might%20be%20magnified%20by%20a%20large%20number%20of%20data%20access%20operations%2C%20to%20reduce%20the%20network%20round%20trips%20for%20the%20data%20access%20operations%20between%20the%20application%20server%20and%20the%20database%20servers%2C%20consider%20using%20the%20option%20to%20either%20batch%20the%20ad%20hoc%20queries%2C%20or%20to%20compile%20them%20as%20stored%20procedures.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReferences%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fperformance-best-practices-for-using-azure-database-for-postgresql%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPerformance%20best%20practices%20for%20using%20Azure%20Database%20for%20PostgreSQL%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fperformance-updates-and-tuning-best-practices-for-using-azure-database-for-postgresql%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPerformance%20updates%20and%20tuning%20best%20practices%20for%20using%20Azure%20Database%20for%20PostgreSQL%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fperformance-troubleshooting-using-new-azure-database-for-postgresql-features%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPerformance%20troubleshooting%20best%20practices%20using%20Azure%20Database%20for%20PostgreSQL%20features%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Database-for-PostgreSQL%2FSteps-to-install-and-setup-PgBouncer-connection-pooling-proxy%2Fba-p%2F730555%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3ESteps%20to%20install%20and%20setup%20PgBouncer%20connection%20pooling%20proxy%20with%20Azure%20DB%20for%20PostgreSQL%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

This blog post discusses migrating from on-prem or IaaS database to an Azure Database for MySQL and Azure Database for PostgreSQL PaaS databases.

 

When migrating from an on-prem database server or an IaaS server to the PaaS service few things needs to be in mind in terms of performance expectations. Azure Database for PostgreSQL and Azure database for MySQL (PaaS) comes with a great features that reduce the manual management effort on the database servers, such as High availability, Automated Backups, Server Monitoring for resource utilization, Security such as encryption, Firewall and SSL, Performance insights and recommendations, Portal UI for the server management, etc.

 

All these features are maintained by background processes that have cost in terms of performance which is not the case in the Azure VM and the on-prem solution, This will require to setup the expectations that your PaaS server should have more resources horse power to perform at the same level as the on-prem or the IaaS server.

 

On-prem servers will generally have a better performance compared to cloud based database servers for the above mentioned reason and for the fact that the on-prem servers have way less geographical distance between the application and the database servers which means less network latency.

 

Solution: Please consider the following performance recommendations and best practices while building your environment:

 

1) Server resources specifications:
Set the specifications (number of vCores and Disk size) for your PaaS server to accommodate your workload and avoid high resource utilization.  


2) connection pooling
Make sure that the application has connection pooling implemented as a best practice to communicate with a PaaS database server.

Let’s take Azure Database for PostgreSQL as an example: servers establishing a connection is an expensive operation. This is attributed to the fact that each new connection to the PostgreSQL requires forking of the OS process and a new memory allocation for the connection. As a result, transnational applications frequently opening and closing the connections at the end of transactions can experience higher connection latency, resulting in lower database throughput (transactions per second) and overall higher application latency. It is therefore recommended to leverage connection pooling when designing applications using Azure Database for PostgreSQL. This significantly reduces connection latency by reusing existing connections and enables higher database throughput (transactions per second) on the server. With connection pooling, a fixed set of connections are established at the startup time and maintained. This also helps reduce the memory fragmentation on the server that is caused by the dynamic new connections established on the database server.

 

3) VMs with accelerated networking:

Accelerated Networking enables single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance. This high-performance path bypasses the host from the datapath, reducing latency, jitter, and CPU utilization, for use with the most demanding network workloads on supported VM types. The following picture shows communication between two VMs with and without accelerated networking:

Without accelerated networking, all networking traffic in and out of the VM must traverse the host and the virtual switch. The virtual switch provides all policy enforcement, such as network security groups, access control lists, isolation, and other network virtualized services to network traffic. To learn more about virtual switches, read the Hyper-V network virtualization and virtual switch article.

accelrated networking.jpg


4) Application and Database servers in the same Data Center:

Make sure your Application and database are in the same data center, applications that access data by using high-volume, frequent, ad hoc querying, a substantial amount of response time is spent on network communication between the application tier and the Azure Database for MySQL and Azure Database for PostgreSQL. Even when both the application and Azure Database are in the same data center, the network latency between the two might be magnified by a large number of data access operations, to reduce the network round trips for the data access operations between the application server and the database servers, consider using the option to either batch the ad hoc queries, or to compile them as stored procedures.

 

References: