简体   繁体   English

IOPS(在 Amazon EBS 中)在实践中意味着什么?

[英]What does IOPS (in Amazon EBS) mean in practice?

I have some images needed for an app.我有一些应用程序所需的图像。 There are many images (50,000+) but the overall size is small (40 Mb).有很多图像(50,000+),但整体大小很小(40 Mb)。 Initially, I thought I would simply use S3 but it is painfully slow to upload.最初,我以为我只会使用 S3,但上传速度非常慢。 As a temporary solution, I wanted to attach an EBS containing the images and that would be fine.作为临时解决方案,我想附加一个包含图像的 EBS,这样就可以了。 However, reading a bit about EBS General Purpose (gp2) I noticed the following description:但是,阅读有关 EBS 通用 (gp2) 的一些内容后,我注意到以下描述:

GP2 is the default EBS volume type for Amazon EC2 instances. GP2 是 Amazon EC2 实例的默认 EBS 卷类型。 These volumes are backed by solid-state drives (SSDs) and are suitable for a broad range of transactional workloads, including dev/test environments, low-latency interactive applications, and boot volumes.这些卷由固态驱动器 (SSD) 提供支持,适用于广泛的事务性工作负载,包括开发/测试环境、低延迟交互式应用程序和启动卷。 GP2 is designed to offer single-digit millisecond latencies, deliver a consistent baseline performance of 3 IOPS/GB to a maximum of 10,000 IOPS, and provide up to 160 MB/s of throughput per volume. GP2 旨在提供个位数毫秒的延迟,提供 3 IOPS/GB至最大 10,000 IOPS的一致基准性能,并提供高达 160 MB/s 的每个卷的吞吐量。

It is that 3 IOPS/GB quantity that is worrying me.让我担心的是 3 IOPS/GB 的数量。 What does this mean in practical terms?这在实际中意味着什么? Suppose that you need an e-commerce site for a small amount of users (eg < 10,000 requests per minute) and these images need to be retrieved.假设您需要一个供少量用户使用的电子商务站点(例如,每分钟 < 10,000 个请求)并且需要检索这些图像。 Amazon describes how IOPS are measured:亚马逊描述了如何衡量 IOPS:

When small I/O operations are physically contiguous, Amazon EBS attempts to merge them into a single I/O up to the maximum size.当小型 I/O 操作在物理上是连续的时,Amazon EBS 会尝试将它们合并为一个最大大小的 I/O。 For example, for SSD volumes, a single 1,024 KiB I/O operation would count as 4 operations, while 256 I/O operations at 4 KiB each would count as 256 operations.例如,对于 SSD 卷,单个 1,024 KiB I/O 操作将计为 4 个操作,而 4 KiB 的 256 个 I/O 操作将计为 256 个操作。

Does this actually mean that if I want to retrieve 50 images of 10kB each in under a second, I would require 50 IOPS and easily exceed the baseline of 3 IOPS?这是否真的意味着如果我想在一秒内检索 50 张 10kB 的图像,我需要 50 IOPS 并且很容易超过 3 IOPS 的基线?

UPDATE :更新

Thanks to Mark B's suggestion, I was able to use S3 to upload my files.感谢 Mark B 的建议,我能够使用 S3 上传我的文件。 However, I'm still wondering about the amount of IOPS needed to perform common tasks such as running a database or serving other files for a web application.但是,我仍然想知道执行常见任务(例如运行数据库或为 Web 应用程序提供其他文件)所需的 IOPS 量。 I would be glad to hear some reference values regarding the minimal values of IOPS based on your experience.根据您的经验,我很高兴听到一些关于 IOPS 最小值的参考值。

You are missing the " /GB " part of that statement.您缺少该语句的“ /GB ”部分。 The baseline is 3 IOPS per GB .基准是每 GB 3 IOPS。 If your EBS volume is 100GB, then you would have a baseline of 300 IOPS.如果您的 EBS 卷为 100GB,那么您的基线为 300 IOPS。 For a GP2 EBS volume you have to multiple the size of the volume by 3 to get the IOPS.对于 GP2 EBS 卷,您必须将卷的大小乘以 3 才能获得 IOPS。

Note that any GP2 volume under 1TB is also able to burst at up to 3,000 IOPS, so any limited increases in IO should still perform very well.请注意,任何 1TB 以下的 GP2 卷也能够以高达 3,000 IOPS 的速度突增,因此任何有限的 IO 增加都应该仍然表现良好。


Also, I will add that S3 sounds like a better fit for your use case.此外,我还要补充一点,S3 听起来更适合您的用例。 If you are seeing slow upload speeds to S3, that is a problem that can be solved.如果您看到 S3 的上传速度缓慢,这是一个可以解决的问题。 You can use CloudFront to provide a nearby edge location that you can upload to.您可以使用CloudFront提供可以上传到的附近边缘站点。

In my experience uploads to S3 are never any slower than uploads to an EC2 instance that your EBS volume would be attached to.根据我的经验,上传到 S3 永远不会比上传到 EBS 卷将附加到的 EC2 实例慢。


Update:更新:

To answer your additional question, the minimum IOPS needed will depend on many variables such as the amount of RAM available, the type of application you are running, how well the application caches values in memory, the average size of your IO operations, etc. It's really difficult to pin-down an exact number and state that you need exactly X IOPS for an application.要回答您的其他问题,所需的最低 IOPS 将取决于许多变量,例如可用 RAM 量、您正在运行的应用程序类型、应用程序在内存中缓存值的程度、IO 操作的平均大小等。确定一个确切的数字并说明您的应用程序恰好需要 X IOPS 真的很困难。

You also need to remember that any volume under 1TB in size can still burst up to 3,000 IOPS for several seconds.您还需要记住,任何大小低于 1TB 的卷仍然可以在几秒钟内突增至 3,000 IOPS。 So even if your application needs high IOPS when it is in use, if it doesn't see much usage the IOPS burst feature might be all it ever needs.因此,即使您的应用程序在使用时需要高 IOPS,如果它没有看到太多使用情况,IOPS 突发功能可能就是它所需要的全部。

In general I usually start with something like a 100GB volume with 300 IOPS and test the performance of my app against that.一般来说,我通常从 100GB 卷和 300 IOPS 之类的东西开始,然后测试我的应用程序的性能。 A web server that operates entirely within RAM might never need more than that.完全在 RAM 中运行的 Web 服务器可能永远不需要更多。 For something like a database you would probably start out with the amount of disk space you think you will need and then start performance testing.对于像数据库这样的东西,您可能会从您认为需要的磁盘空间量开始,然后开始性能测试。 CloudWatch will show the amount of IOPS your application is using, and if you see it maxing out at the limits of your volume then you would know you need to increase the available IOPS. CloudWatch 将显示您的应用程序正在使用的 IOPS 量,如果您看到它在您的容量限制下达到最大值,那么您就会知道您需要增加可用的 IOPS。 Rinse and repeat until you no longer max out the available IOPS during your performance tests.冲洗并重复,直到您在性能测试期间不再最大化可用 IOPS。

@Mark B's answer is probably correct, in that it points out your IOPs are based on the size of your EBS volume. @Mark B 的回答可能是正确的,因为它指出您的 IOP 取决于您的 EBS 卷的大小。 For what you want, S3 is the best option.对于您想要的,S3 是最佳选择。

But depending on your use case and requirements, EBS may be needed.但根据您的用例和要求,可能需要 EBS。 This is especially true if you want to run a database.如果您想运行数据库,则尤其如此。 In that case, you have a couple of options.在这种情况下,您有几个选择。

You can get Provisioned IOPS - if you know you need 5000 IOPS, but only need say 100GB of storage (which with gp2 would normally provide you with around 300 IOPS), you can use io1 volumes.您可以获得预置 IOPS - 如果您知道需要 5000 IOPS,但只需要说 100GB 的存储空间(使用 gp2 通常可以为您提供大约 300 IOPS),您可以使用 io1 卷。 There is an extra cost to this, and you'll want to make sure that it's attached to an EBS optimized instance, but you can get up to 20k IOPS if needed.这会产生额外的成本,您需要确保将其附加到 EBS 优化实例,但如果需要,您可以获得高达 20k 的 IOPS。

If you're doing a lot of sequential reads (reading in a large data set?) then there's a new type of EBS, st1.如果您要进行大量顺序读取(读取大型数据集?),那么有一种新型 EBS,st1。 This is good for 500MB/s, and is less than 1/2 the cost of gp2.这对于 500MB/s 来说是不错的,并且不到 gp2 成本的 1/2。

Finally, there's one other scenario you could consider (say, you're a bit of a madman, and want to try doing strange things).最后,您还可以考虑另一种情况(例如,您是个疯子,想尝试做一些奇怪的事情)。 If you can grab an archive from somewhere, and all you care about is serving them up from a really fast file system, you could put them on an instance that has instance storage.如果您可以从某个地方获取存档,并且您所关心的只是从一个非常快速的文件系统中提供它们,您可以将它们放在具有实例存储的实例上。 This is a locally-attached SSD, so it's very fast.这是一个本地连接的 SSD,所以速度非常快。 The only drawback is that when your instance stops, you data is gone.唯一的缺点是当您的实例停止时,您的数据就会消失。

To address your update, "how many IOPS do you need for a database", the answer is "it depends".为了解决您的更新,“您需要多少 IOPS 数据库”,答案是“视情况而定”。 Every database engine has different requirements, and every database use has different usage patterns.每个数据库引擎都有不同的要求,每个数据库的使用都有不同的使用模式。 Take a look at this if you want more information.如果您想了解更多信息,请查看此内容 But basically, test & monitor.但基本上,测试和监控。 If you're worried, over provision at launch, and scale down as needed.如果您担心,请在发布时过度配置,并根据需要缩小规模。 Or take a guess, and increase if you run into problems - is it more important to minimize costs, or provide good performance to your end users?或者进行猜测,并在遇到问题时增加 - 最小化成本还是为最终用户提供良好的性能更重要?

As per your use case, s3 is a better option but if one wants to use an EBS volume and thinks that they require more IOPS, they can choose gp3 volume type instead of gp2.根据您的用例,s3 是更好的选择,但如果有人想使用 EBS 卷并认为他们需要更多 IOPS,他们可以选择 gp3 卷类型而不是 gp2。 In gp3 volume, one can increase upto 16,000 IOPS independent of throughput (also, throughput can be increase upto 1000 MiB/s independently of IOPS).在 gp3 卷中,可以独立于吞吐量增加 16,000 IOPS(此外,吞吐量可以独立于 IOPS 增加至 1000 MiB/s)。

General Purpose SSD (gp2) volumes offer cost-effective storage that is ideal for a broad range of workloads.通用型 SSD (gp2) 卷提供经济高效的存储,非常适合各种工作负载。 These volumes deliver single-digit millisecond latencies and the ability to burst to 3,000 IOPS for extended periods of time.这些卷提供个位数的毫秒延迟,并能够在很长一段时间内突增至 3,000 IOPS。 Between a minimum of 100 IOPS (at 33.33 GiB and below) and a maximum of 16,000 IOPS (at 5,334 GiB and above), baseline performance scales linearly at 3 IOPS per GiB of volume size.在最低 100 IOPS(33.33 GiB 及以下)和最高 16,000 IOPS(5,334 GiB 及以上)之间,基准性能以每 GiB 卷大小 3 IOPS 线性扩展。 AWS designs gp2 volumes to deliver 90% of the provisioned performance 99% of the time. AWS 设计了 ​​gp2 卷以在 99% 的时间内提供 90% 的预配置性能。 A gp2 volume can range in size from 1 GiB to 16 TiB. gp2 卷的大小范围从 1 GiB 到 16 TiB。 link:链接:

  1. Link 链接

Sometimes performance also varies: According to AWS Doc, instance types can support maximum performance for 30 minutes at least once every 24 hours.有时性能也会有所不同:根据 AWS Doc,实例类型每 24 小时至少可以支持 30 分钟的最高性能。 If you have a workload that requires sustained maximum performance for longer than 30 minutes, select an instance type according to baseline performance link:如果您的工作负载需要持续最大性能超过 30 分钟,请根据基准性能链接选择实例类型:

  1. Link 链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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