r/SQLServer • u/confused_112 • Jan 15 '26
Question SQL server migrated to AWS
Hi everyone,
Our infra team moved SQL server 2019 and Application Server (does the authentication part) to AWS EC2 instance (r6i.4xlarge).
When it was on prem, the latency on Database volume was under 15ms but after we did lift and shift to AWS the latency has been increased to 90ms which is really affecting the read and write operations.
We are using gp3 drives with IOPS 15000 and throughput 1000 MiB (increased after facing slowness) to counter the issue but unable to resolve the lag.
AWS network is reached from S2S VPN tunnel from on prem fortigate and its not saturating when checked Packer Per Second and bandwidth.
Any suggestions on how to optimize and fine tune the database or network to resolve this?
3
u/KickAltruistic7740 Jan 15 '26
Something somewhere is a bottleneck. We run all our high performance environments on GP3 for data and NVME for tempdb. Check your disk Queue Lengths and make sure the instance you are using is capable of supporting the combined total IOPS and Throughput of the disks running attached to your instance.
2
u/Similar_Anything5970 Jan 15 '26
How many disks do you have & is the DB spread across them? r6i.4xlarge has a baseline IOPS limit of 20000 for the whole machine, with a burst of 40000 for 30 mins. If you're getting high IOPS numbers on more than 1 disk at a time then you could be hitting this limit.
https://docs.aws.amazon.com/ec2/latest/instancetypes/mo.html#mo_storage-ebs
4
u/B1zmark 1 Jan 15 '26
I don't work with AWS, but MS has locally attached volatile storage available on Azure servers - stuff that's physically attached to the box and not a network resource. This tends to have no guarantee about data being saved after a reboot, but it's a great location for things like TempDB to improve query performance when queriers leave RAM and need to go to disk.
7
u/jdanton14 Microsoft MVP Jan 15 '26
GP3 won’t cut it. You likely need at least IO2. AWS isn’t as good at Azure about documenting the IO and bandwidth limits for each VM, but that doc does exist.
Someone else mentioned local storage, but that’s ephemeral so in order to use it you need to build an AG and think about it. However you can use the instance volumes for tempdb.
3
u/PM_ME_UR_BIG_DOINKS Jan 16 '26
Reading other comments, it seems like you’ve ruled out disk problems. You could just be seeing network latency due to the distance to the AWS region from your on premises infra. Things like VPNs and DirectConnects (or ExpressRoutes) can’t fully eliminate latency, but they can make it more consistent than routing over the public internet. You could probably verify this with something like PSPing to see how long your packets take on the wire to different hops.
If possible, you could stand up another ec2 instance and do a test connection to sql server entirely within the AWS region and see if your latency remains the same as on prem. If it’s similar or the same, it’s likely ec2 or sql server performance issues. If it’s much lower latency, you’re looking at a speed of light problem.
2
u/dbrownems Microsoft Employee Jan 16 '26 edited Jan 16 '26
It's normal for cloud hosting to have inferior IO to on-prem. There may be ways to pay for better storage, or configure it optimally (we have extensive guidance on Azure), but it can be better to troubleshoot and optimize.
So you can treat this as your super-fast on-prem storage masking problems with your application.
SQL Server user queries only wait for IO on transaction commit, page cache miss, large spools, and bulk load (rare). So addressing why you have user queries or transactions waiting on IO can be more effective than chasing the IO performance you had on-prem.
Start by looking at your session wait stats or query store wait stats to find where users are waiting on storage, and then dig in to figure out why.
1
u/Nefka_at_work Jan 15 '26
Go in AWS console and check the performances of the volumes of the EC2 instance. Check how it looks in monitoring graphics and what AWS Compute Optimizer finding is recommending.
In AWS, there is the equivalent of the attached volatile storage mentioned by /u/B1zmark, it's called local NVMe storage, and the instance type is r6id (or whatever type of instance ending with "d"): AWS News Blog New – Amazon EC2 R6id Instances with NVMe Local Instance Storage of up to 7.6 TB
1
u/Red_Wolf_2 Jan 15 '26 edited Jan 15 '26
Depending on which region you've got the DB servers in, consider switching to r8i instead of r6i. You can also tune the EBS vs ENI throughput further on r8i instances as well as getting a bit of a CPU improvement, although ultimately the limiter is that behind the scenes, the EBS system is sort of like a super SAN and there are certain bandwidth limits between the EC2 instances and storage infrastructure.
You'll also have a better time with latency by going to io2 instead of gp3 volume types. I'd check what exactly you've got going on with disk IO (eg heavy tempdb usage) and split them onto their own volume (ideally an instance store volume, although that comes with its own caveats when stopping and starting the instance) as well as checking SQL server has been configured to handle the available RAM on the instance you've configured.
1
u/Dry_Author8849 Jan 16 '26
Well, performance suffers when expanding or creating a new EBS volume. It's a background initialization process that can take several hours, sometimes a day if the volume is large.
Snapshots also degrade performance, and if you cause an IO storm, such as a heavy db maintenance task that includes index re creation also can choke an EBS volume.
Also follow the guidelines for page file configuration.
Open a ticket. There is a lot going on in the background. Attach performance monitor counters, like write latency and disk queue length.
We have 3 instances running without issues and acceptable performance.
Cheers!