{"id":628,"date":"2013-02-14T15:08:41","date_gmt":"2013-02-14T15:08:41","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=385"},"modified":"2013-02-14T15:08:41","modified_gmt":"2013-02-14T15:08:41","slug":"amazon-ec2-common-problems-theres-no-swap-space","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/amazon-ec2-common-problems-theres-no-swap-space\/","title":{"rendered":"Amazon EC2 common problems – there’s no swap space"},"content":{"rendered":"

Ubuntu EC2 EBS images don’t come with swap space configured (for 11.04 at least). The “regular” instance-type images do have a swap partition, though only 896 MB.<\/p>\n

\"amazonec2\"<\/p>\n

If some process blows up and you don’t have enough memory or a swap space, your server could come to a crawling halt for a good while before the OOM (out of memory) killer kicks in, whereas with swap, it merely gets slow. For that reason, I always like to have swap space around, even with enough RAM.<\/p>\n

<\/p>\n

The simplest solution here is to create a swap file ( this is my favorite choice), we can create one (size 1024) using this command :<\/p>\n

\nsudo dd if=\/dev\/zero of=\/var\/swapfile bs=1M count=1024 &&\nsudo chmod 600 \/var\/swapfile &&\nsudo mkswap \/var\/swapfile &&\necho \/var\/swapfile none swap defaults 0 0 | sudo tee -a \/etc\/fstab &&\nsudo swapon -a\n<\/pre>\n

Done. \ud83d\ude42 I know a lot of people feel icky about using files instead of partitions, but it certainly works well enough as emergency swap space.<\/p>\n

actually you can use a swap partition if you want to, but amazon EC2 “normal” instances don’t support it.<\/p>\n

collected from http:\/\/serverfault.com\/a\/279632<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

Ubuntu EC2 EBS images don’t come with swap space configured (for 11.04 at least). The “regular” instance-type images do have a swap partition, though only 896 MB. If some process blows up and you don’t have enough memory or a swap space, your server could come to a crawling halt for a good while before…<\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[69,49,70,71,72,51],"aioseo_notices":[],"views":7,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/628"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=628"}],"version-history":[{"count":0,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/628\/revisions"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=628"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}