AWS EC2 high ping and S3 download slow - performance

i am new to AWS.
I have some questions want to know.
my EC2 instance :
Instance type : t2.micro - windows server
EC2 region : Asia Pacific (Tokyo)
S3 region : AWS write "S3 does not require region selection."
User location : Taiwan
My EC2 ping is too high to my real-time game and S3 download sometimes is very slow.
My network type is WiFi and Cellular networks(3G&4G).
I have test with my local server, 5 users connected and all work fine.
Average 80kb/s per user for EC2.
Questions:
1.Why my client ping EC2, the time always over 100ms?
2.How can i reduce ping under 100ms?
3.Why S3 download speed is very unstable, 50k~5mb?
4.How can i keep download speed stable?

Regarding S3:
It DOES matter where you create your S3 bucket:
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html
"Amazon S3 creates bucket in a region you specify. You can choose any AWS region that is geographically close to you to optimize latency, minimize costs, or address regulatory requirements. For example, if you reside in Europe, you might find it advantageous to create buckets in the EU (Ireland) region."
On the other hand, "S3 does not require region selection." Means you can access any bucket from any region, though access is optimized for the region where the bucket is located. Bucket location can be set only at the time they are created
Regarding unstable times:
t2.micro is not designed to provide a stable capacity. Instead, its capacity is throttled. Actually any instance type starting with t2 has throttled (non constant) CPU capacity. I suggest you try with a larger instance, like m1.small .
See http://www.ec2instances.info/ , any instance that says "burstable" has a non-stable performance.

Related

Benchmarking amazon EC2 vs Google compute engine

For EC2: t2.micro, host in Oregon
For compute engine: n1-standard-1, in west-us
Both in ubuntu 16.04, single instance. I installed nvm, then node js 7.7.2 and initiated a simple server:
require('http').createServer(function(req, res) {
res.end('Hello world')
}).listen(8080)
Then from my local machine, I used wrk for bench marking
wrk -t12 -c400 -d10s http://myinstanceaddress
Result, average of 5:
EC2: ~1200 requests/s
Compute engine: ~500 requests/s
I expected that compute engine n1-standard-1 would perform better than EC2 t2.micro since the former has more CPU and power. However, the result indicated otherwise.
So, my question is: is this simple benchmark accurate, what other factors that I need to consider? If the benchmark is accurate, does this mean AWS EC2 t2.micro actually performs better than google compute engine n1-standard-1 despite the later has more power (CPU and memory as advertised)?
Have you checked the network path (e.g. latency) between the two nodes, using a tool like ping?
I'm guessing that you're actually being limited by the network path somewhere along the way.

Google Compute have used CDN?

I already used Google Compute instance, and it's located us-central.
I'm living Taiwan, ping the instance than average time 180~210ms.
Amazon EC2 located Singapore, average time 70~80ms.
I think this difference latency result, depend your server located, right?
So I guessed Google Compute Engine doesn't support CDN, right?
even Amazon ec2 also the same.
Kind Regards,
PinLiang
Google Compute runs code while a CDN delivers content (**C**ontent **D**elivery **N**etwork) so they aren't the same thing. If you get better latency to Amazon EC2 then use that instead but be aware that Google Compute and EC2 work very differently and you wont be able to run the same code on both.
If you want low latency (to Taiwan) compute resources you might want to consider using a Compute Engine instances in the Asia zones, see: 4/14/2014 - Google Cloud Platform expands to Asia
Yes, location and network connectivity will determine your latency. This is not always obvious though. Submarine cables tend to take particular paths. In some cases a geographically closer location may have higher latency.
A CDN is generally used for distributing static files, at lower latency to more users. Cloudfront can use any site as a custom origin.

Does detaching EC2 Volume save cost

I just got hit with a large EC2 bill while I didn't have more than one machines running.
After investigating my bill in a bit more detailed I saw that we were paying $1100 per month for provisioned IOPS. This turned out to be caused by 10 volumes of 1000 IOPS each for servers which had long since been switched off.
My question is whether Detaching these volumes will stop me paying for them. Or do I need to delete these volumes fully.
I don't mind paying a small cost for keeping them around in case we might need them again, but paying $1100 per month just to keep them lying around is ridiculous.
From what I know (and what I can confirm from the EC2 Documentation), Amazon does not charge you for an instance which is stopped. But they do charge for EBS volumes.
Quoting from the documentation:
When you stop an instance, we shut it down. We don't charge hourly
usage for a stopped instance, or data transfer fees, but we do charge
for the storage for any Amazon EBS volumes.
Also quoting from here:
Provisioned IOPS is charged by the amount you
provision in IOPS (input/output operations per second) X the
percentage of days you provision for the month. For example, if you
provision a volume with 1000 IOPS, and keep this volume for 15 days in
a 30 day month, then in the Virginia Region, you would be charged $50
for the IOPS that you provision ($0.10 per provisioned IOPS-Month *
1000 IOPS Provisioned * 15 days/30).
Since you provision the input/output operations, you pay for them even if you don't actually use them. So as long as you have provisoned IOPS, even if the EC2 volume is stopped and even if the EBS volume is not attached to an EC2 instance, you will have to pay for it.
Sorry about the huge bill you got for a service you were not using :( Have you tried contacting Amazon about this issue? Maybe they will reduce the amount or scratch it off from the bill alltogether?
You need to delete the volumes completely. If you need to keep stuff around create a snapshot of the volume first, then you can delete the volume entirely. EBS storage isn't particulary cheap unlike S3 or Glacier.
Once you have created the snapshot, you can restore it by creating a volume from the snapshot.
** Don't leave unused EBS volumes lying around **
AWS charges for unattached EBS volumes. You can take a snapshot and delete the volumes to save cost. I am using this template under the free tier. You can edit it to take a snapshot before deleting by adding an Action Node.

AWS RDS Provisioned IOPS really worth it?

As I understand it, RDS Provisioned IOPS is quite expensive compared to standard I/O rate.
In Tokyo region, P-IOPS rate is 0.15$/GB, 0.12$/IOP for standard deployment. (Double the price for Multi-AZ deployment...)
For P-IOPS, the minimum required storage is 100GB, IOP is 1000.
Therefore, starting cost for P-IOPS is 135$ excluding instance pricing.
For my case, using P-IOPS costs about 100X more than using standard I/O rate.
This may be a very subjective question, but please give some opinion.
In the most optimized database for RDS P-IOPS, would the performance be worth the price?
or
The AWS site gives some insights on how P-IOPS can benefit the performance. Is there any actual benchmark?
SELF ANSWER
In addition to the answer that zeroSkillz wrote, I did some more research. However, please note that I am not an expert on reading database benchmarks. Also, the benchmark and the answer was based on EBS.
According to an article written by "Rodrigo Campos", the performance does actually improve significantly.
From 1000 IOPS to 2000 IOPS, the read/write(including random read/write) performance doubles. From what zeroSkillz said, the standard EBS block provices about 100 IOPS. Imagine the improvement on performance when 100 IOPS goes up to 1000 IOPS(which is the minimum IOPS for P-IOPS deployment).
Conclusion
According to the benchmark, the performance/price seems reasonable. For performance critical situations, I guess some people or companies should choose P-IOPS even when they are charged 100X more.
However, if I were a financial consultant in a small or medium business, I would just scale-up(as in CPU, memory) on my RDS instances gradually until the performance/price matches P-IOPS.
Ok. This is a bad question because it doesn't mention the size of the allocated storage or any other details of the setup. We use RDS and it has its pluses and minuses. First- you can't use an ephemeral storage device with RDS. You cant even access the storage device directly when using the RDS service.
That being said - the storage medium for RDS is presumed to be based on a variant of EBS from amazon. Performance for standard IOPS depends on the size of the volume and there are many sources stating that above 100GB storage they start to "stripe" EBS volumes. This provides better average case data access both on read and write.
We run currently about 300GB of storage allocation and can get 2k write IOP and 1k IOP about 85% of the time over a several hour time period. We use datadog to log this so we can actually see. We've seen bursts of up to 4k write IOPs, but nothing sustained like that.
The main symptom we see from an application side is lock contention if the IOPS for writing is not enough. The number and frequency you get of these in your application logs will give you symptoms for exhausting the IOPS of standard RDS. You can also use a service like datadog to monitor the IOPS.
The problem with provisioned IOPS is they assume steady state volumes of writes / reads in order to be cost effective. This is almost never a realistic use case and is the reason Amazon started cloud services to fix. The only assurance you get with P-IOPS is that you'll get a max throughput capability reserved. If don't use it, you pay for it still.
If you're ok with running replicas, we recommend running a read-only replica as a NON-RDS instance, and putting it on a regular EC2 instance. You can get better read-IOPS at a much cheaper price by managing the replica yourself. We even setup replicas outside AWS using stunnel and put SSD drives as the primary block device and we get ridiculous read speeds for our reporting systems - literally 100 times faster than we get from RDS.
I hope this helps give some real world details. In short, in my opinion - unless you must ensure a certain level of throughput capability (or your application will fail) on a constant basis (or at any given point) there are better alternatives to provisioned-IOPS including read-write splitting with read-replicas memcache etc.
So, I just got off of a call with an Amazon System Engineer, and he had some interesting insights related to this question. (ie. this is 2nd hand knowledge.)
standard EBS blocks can handle bursty traffic well, but eventually it will taper off to about 100 iops. There were several alternatives that this engineer suggested.
some customers use multiple small EBS blocks and stripe them. This will improve IOPS, and be the most cost effective. You don't need to worry about mirroring because EBS is mirrored behind the scenes.
some customers use the ephemeral storage on the EC2 instance. (or RDS instance) and have multiple slaves to "ensure" durabilty. The ephemeral storage is local storage and much faster than EBS. You can even use SSD provisioned EC2 instances.
some customers will configure the master to use provisioned IOPS, or SSD ephemeral storage, then use standard EBS storage for the slave(s). Expected performance is good, but failover performance is degraded (but still available)
anyway, If you decide to use any of these strategies, I would recheck with amazon to make sure I haven't forgotten any important steps. As I said before, this is 2nd hand knowledge.

At what requested disk size does Amazon RDS use striping?

From the Amazon RDS FAQ Page
http://aws.amazon.com/rds/faqs/
"Depending on the size of storage requested, Amazon RDS automatically stripes across multiple EBS volumes to enhance IOPS performance"
What disk size do I need to request to trigger disk striping? I've only heard rumors of 300GB.
I had a conversation with upper management at AWS regarding this. Here is the direct answer provided by them.
You will realize improvements with RDS throughput by scaling storage as high as 500GB, and this effect starts at a level well under 100GB (ie: striping occurs at a far lower level than 300GB).
The most important factor in realizing this throughput potential is the instance class. Specifically, the following instance classes are considered High I/O instances:
m1.xlarge
m2.2xlarge
m2.4xlarge
These instances have large network bandwidth available to them, so the upgrade that you mentioned on stackoverflow (to the m2.2xlarge instance) was likely the main reason you saw a leap in throughput. If you stripe your current storage as high as 500GB, this will continue to increase. With provisioned IOPS support for RDS (PIOPS-announced last night), throughput will now scale linearly all the way to 1TB.
With PIOPS, the throughput rate you can expect is currently associated with the amount of allocated storage. For Oracle and MySQL databases, you will realize a very consistent 1,000 IOPS for each 100GB you allocate – resulting in a potential throughput max of 10K IOPS. The (current, temporary) downside is that you will need to unload/load data to migrate an existing app to the PIOPS RDS.
Last I checked 300gb triggers back-end striping
I was told recently by an AWS engineer on an architecture review that 100GB will trigger EBS striping

Resources