How to improve AWS RDS Performance - Heavy read write updates

After searching and reading as many posts, comments and discussions I could find I did not find one specific to my issue.

I have multiple AWS EC2 deployments with a single RDS all in the same Delivery zone us-west-2(c)

I am testing the load of the instances at a fraction of what I will be expecting very soon. The issue that concerns me is the performance while pushing updates. We will be frequently acquiring updates of 1,000 records at a time and will take and compare our data and update our data as appropriate. Consequently one read and one write per entry. It is not uncommon to have 100,000 updates come to us in an hour.

Currently I have a MySQL Database on an AWS t2.medium class RDS running 5 update processes at 22% CPU and less than 1GB Memory.

Even with these low numbers the read time to search the database of 106.3K records takes 2 to 3 full seconds and the write time is another 2 seconds.

I need some thoughts on how to improve these read/write times.

Additional info: I have a replica instance running as well. The CMS driven sites (100 and growing daily) connect to the replica instance for their content.

Thanks!


I'm going to turn my comments above into an answer.

T2 instances only get a fraction of a CPU - 10% for a t2.micro, 40% for a t2.medium. You get CPU credits that build up, but once you use them you get throttled for CPU. You also get lower network and IO performance as you have to share physical machine resources.

What I suspect is happening is your testing has run out of CPU credits so you're being throttled. You can monitor CPU credits in CloudWatch, this will tell you whether or not my guess is correct.

Whether I'm right or not, t2 instances aren't suitable for systems that get work coming in constantly. A C4 or other general instance would probably be your best bet. You can monitor your database memory and CPU usage in CloudWatch to help work out what database instance size you need.


Take note of the disk bottleneck : Disk IOPS. RDS will throttle IO request if it is not provisioned. There is 3iops/GB given to SSD. So if you have 100GB allocated for SSD, you can max up 3x100 = 300 iops block.
If you pay for provisioned SSD, you can provision iops more than that.

While for standard(magentic) storage, additional per millions iops charge count, and the burst is 40-200 iops.

Please go check your RDS io log on the activities to determine better disk io strategy. More info reference : https://stackoverflow.com/questions/18777070/aws-rds-provisioned-iops-really-worth-it