ChatGPT解决这个技术问题 Extra ChatGPT

Amazon EC2: Ubuntu(PV) or Ubuntu(HVM)

I am about to launch Ubuntu instance on Amazon EC2. I'm choosing between PV and HVM options. I found that PV does provide a more efficient virtualization model though I could be wrong and as Amazon offers both options I'm suggesting that HVM may could have some benefits I will not get with PV. I want to use this virtual machine for GIT and maybe Team City in future. Could you help me to choose?

One thing that I've noticed with HVM the instances type changed and some of the weaker ones will be disappeared. For instance there is no m1.Large with Ubuntu 12.04 (HVM).
@PaulWhipp: That document is now outdated. HVM images can now use PV drivers for higher performance.
What IS PV and HVM??

B
BraveNewCurrency

I would say "go with PV" (on Linux) unless you have a reason. PV has been much better tested because it was the only option for many years. (HVM for Linux was only recently introduced outside of the very special Compute Cluster nodes.)

Converting between them isn't very hard -- especially if you do it right. By "do it right", I mean using something like Chef or Puppet or Ansible to build your server. This lets you put your "server" (well, server build process) under version control, which creates instant documentation for everyone to understand what's on your server.

Your root drive should be ephemeral, so that if the server dies, you can just re-launch and re-attach your EBS data. (And you can quickly upgrade the OS or server software by launching a 2nd instance to play with.) If you have an EBS root drive, you'll have to pay to store/backup your OS, and you'll never know if your server config is checked into version control or not.

UPDATE: Going forward, I would lean toward HVM, since performance can be much better (i.e. "Enhanced Networking"). Also, it's not "brand-new" anymore.


This is a very good and correct answer. However, please see @Kristo J's answer about burstable performance on the new t2 instances, which essentially means a large increase in cost-effectiveness of the HVM instances over PV. I've linked a thorough blog post about the subject in a comment on that answer.
Agreed. Lots of new instance types are HVM only, and I haven't seen any HVM-specific problems.
You have to choose HVM if you want to use "Enhanced Networking" (docs.aws.amazon.com/AWSEC2/latest/UserGuide/…).
I agree with the "Do it right" part. Though "go with PV" was accurate in April 2014 when this answer was given, today it should be "Go with HVM" for Linux servers.
Agreed. Updating answer.
D
Devy

In summer 2014, Amazon started recommending using HVM over PV AMIs as HVM seems to be the vision going forward. A lot of the newer & current generation instance types are only supported by HVM AMIs, for instance, memory optimized r3 types See here

With the push and R&D Amazon throwing in optimizing HVM, the PV AMI performance edge is going to be smaller and smaller IMMO.


Aerospike: HVM is much better highscalability.com/blog/2014/8/18/…
K
Kristo J

Amazon just recently came out with t2 instances that use only HVM. With the t2 instance aws introduces burstable performance(use resources when in need using credits, otherwise don't run in full power) and cpu credits(obtain credits if not running in full power over 24h period of time) to ec2 instances which lowers the price dramatically.

Currently this is available only on micro, small and medium instances.

Note that it won't have local instance storage so you'd need to include at least one ebs volume.

Check out the blog post


This is an incredibly important consideration, with the t2 instances being MUCH more cost-effective than t1 counterparts. Here is a nice blog post about it, complete with graphs: aws.amazon.com/blogs/aws/low-cost-burstable-ec2-instances