{"id":390,"date":"2017-10-29T22:26:32","date_gmt":"2017-10-29T22:26:32","guid":{"rendered":"http:\/\/emacslisp.com\/?p=390"},"modified":"2017-10-29T22:26:32","modified_gmt":"2017-10-29T22:26:32","slug":"vps-add-swap-to-enhance-performance","status":"publish","type":"post","link":"http:\/\/emacslisp.com\/?p=390","title":{"rendered":"VPS &#8211; add Swap to enhance performance"},"content":{"rendered":"<p>VPS normally does not have any swap space.<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\nsudo \/bin\/dd if=\/dev\/zero of=\/var\/swap.1 bs=1M count=1024\r\nsudo \/sbin\/mkswap \/var\/swap.1\r\nsudo chmod 600 \/var\/swap.1\r\nsudo \/sbin\/swapon \/var\/swap.1\r\n\r\n\/etc\/fstab:\r\n\/var\/swap.1 swap swap defaults 0 0\r\n\r\n# if it not mounted as swap, using command \r\nsudo \/sbin\/swapon \/var\/swap.1\r\n<\/pre>\n<p>swap size should be 2 times than Memory for 512MB, 1GB Memory.<br \/>\nWhy? take Memory size 512MB for example,  when 512MB is full, it will put into some of data into swap,<br \/>\nif now machine is sleeping, it will put 512MB into swap.<br \/>\ntherefore, ideally swap should be 2 times than physical memory.<\/p>\n<p>However, for large memory such as 16GB, swap size is based on what you need, for example, 2GB.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VPS normally does not have any swap space. sudo \/bin\/dd if=\/dev\/zero of=\/var\/swap.1 bs=1M count=1024 sudo \/sbin\/mkswap \/var\/swap.1 sudo chmod 600 \/var\/swap.1 sudo \/sbin\/swapon \/var\/swap.1 \/etc\/fstab: \/var\/swap.1 swap swap defaults 0 0 # if it not mounted as swap, using command sudo \/sbin\/swapon \/var\/swap.1 swap size should be 2 times than Memory for 512MB, 1GB Memory. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390"}],"version-history":[{"count":1,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions"}],"predecessor-version":[{"id":391,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions\/391"}],"wp:attachment":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}