{"id":868,"date":"2018-03-21T09:35:25","date_gmt":"2018-03-20T21:35:25","guid":{"rendered":"http:\/\/mdickinson.dyndns.org\/php\/wordpress\/?p=868"},"modified":"2018-03-21T09:35:25","modified_gmt":"2018-03-20T21:35:25","slug":"the-jan-feb-updates-to-fedora-27-really-broke-vms","status":"publish","type":"post","link":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/?p=868","title":{"rendered":"The Jan\/Feb updates to Fedora 27 really broke VMs"},"content":{"rendered":"<p>My specific environment is that the VM machines I am having issues with are all CentOS7 or Fedora27 VM guests running on Fedora27 host machines and all are managed by virsh.<\/p>\n<p>I now have a novel and very irritating problem on the servers I use for VM hosts, probably specific to Redhat\/CentOS\/Fedora which has no available setting to limit the amount of cache assigned for IO, so it will use all memory available if it can.<\/p>\n<p>The problem which has appeared since I last upgraded the kernel is that normal background disk IO being placed into memory cache now seems to take priority over running active processes wanting to use memory.<\/p>\n<p>The visible symptoms are <\/p>\n<ul>\n<li>\nKVM virtual machines are being swapped out to disk swapfile space, to the point they stop responding completely, even to ping\n<\/li>\n<li>\nProcesses running on the host machine are being killed by the operating system due to lack of memory\n<\/li>\n<li>\n50% of the real memory on the machine is allocated to disk IO cache\n<\/li>\n<\/ul>\n<p>Excessive cache usage for IO is nothing new, I investigated that long ago to find out there is no way of controlling the percentage of memory used for cache on redhat based systems, to the point I had to include a daily &#8220;\/usr\/sbin\/sysctl vm.drop_caches=3&#8221; command in cron to flush some of that cache.<\/p>\n<p>However until a few months ago I could run five VMs on my main system which would run indefinately&#8230; now I can only run three VMs and eventually one or more of them is after two to three days moved far enough into swap space where they just freeze, not even a &#8220;virsh reboot&#8221; command can recover it&#8230; plus of course there is the additional complication that the OS on the VM host starts killing off some running processes which is also new.<\/p>\n<p>I have altered my webserver instance to use 1Gb memory instead of the 2Gb it was origionally using to see if the host can keep it responding for longer.<\/p>\n<p>A host with 8Gb of memory, <em>the entire host was rebooted yesterday and I have already had a VM freeze<\/em>, now running three VMs assigned a total of 3.5Gb of that memory (actually using 3.5Gb of real memory and two of them combined are also now using 100Mb of swap (the third I have just had to restart again a few minutes ago so hasn&#8217;t swapped yet)), 4Gb of memory used by &#8220;buff\/cache&#8221; so running processes are moving into swap space in preference to IO being flushed from cache&#8230; in an ideal world it would flush cache to avoid swapping out running processes; RedHat based systems do not do that however; or at least do not do it on demand when memory is needed, I assume they do a reclaim periodically but that is no use at the time it is needed.<\/p>\n<p>My test machine which is a host of 32Gb of memory with 23Gb assigned to two VMs seems better behaved in that &#8220;buff\/cache&#8221; is using 3Gb (I have seen it over 10Gb often) but is needing to use 4Gb of swap (yes, the qemu-system-x86 processes are using 3Gb of swap combined between them as well as 25Gb of real memory, these have been running 11 days) which should not happen.<\/p>\n<p>Anyway, this post is because this issue of VMs completely freezing is new behaviour that has occurred only during the last three months; and it annoys me.<\/p>\n<p>I now have the &#8220;\/usr\/sbin\/sysctl vm.drop_caches=3&#8221; running every two hours from cron in the hope it will keep the VMs running longer, even if it does cause a major system slowdown while cache is being flushed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My specific environment is that the VM machines I am having issues with are all CentOS7 or Fedora27 VM guests running on Fedora27 host machines and all are managed by virsh. I now have a novel and very irritating problem &hellip; <a href=\"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/?p=868\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-868","post","type-post","status-publish","format-standard","hentry","category-my-nux-thoughts-and-notes"],"_links":{"self":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=868"}],"version-history":[{"count":2,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/868\/revisions"}],"predecessor-version":[{"id":870,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/868\/revisions\/870"}],"wp:attachment":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}