AWS increase iops

六眼飞鱼酱① 提交于 2019-12-25 09:06:14

问题


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?


回答1:


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 e.g.

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.




回答2:


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, e.g. 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.



来源:https://stackoverflow.com/questions/43497576/aws-increase-iops

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!