简体   繁体   中英

AWS increase iops

I have never used AWS before and have created a php application hosted on an EC2 instance.

The application inserts records into a RDS after processing them. On the free tier it is inserting them at a rate of around 10 records per second.

How would I go about improving the speed at which this process takes place? I have added 100GB provisioned IOPS storage with a limit of 1000 iops.

However when I run my application I get the same speeds as before.

What specs on the Ec2 instance and the RDS instances will determine how quickly it will write to the database?

Providing the EC2 and RDS instance are in the same region you might get a little bit more performance by upping the RDS spec, but generally MySQL is not that fast on write especially as you add more indexes to the table.

You can get better performance by batching your insert's up in the query instead of doing them individually eg

INSERT INTO users (name, gender) VALUES
  ('bob', 'm'),
  ('jane', 'f')

This might be easier if you use some sort of queuing system like SQS or elasticache to write into memory and insert them in batch asynchronously.

Do take note

  1. AWS free tier instance is only mean for casual usage. t2.micro is running on "CPU credit" burst mode. Once you run out of those CPU credit, the server will throttle to more than 25% CPU, thus your performance will suffered.

  2. you should invest a bit in cloudwatch to send RDS IOPS info to learn what is the real issues, eg to find out whether it is CPU, RAM or IO issues.

  3. AWS introduce SSD gp2 storage for quite some time. So you should make use of AWS per GB x 3 IOPS mechanism than jump straight into Provisioned IOPS. This article tell you why you should over provisioned gp2 storage than use provisioned IOPS . You also get extra value for money with gp2 with burst IO.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM