From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: Re: How many threads should a kvm vm be starting? Date: Wed, 28 Sep 2011 08:41:19 +0100 Message-ID: <20110928074119.GB21102@redhat.com> References: <201109261829.38937.thomas@fjellstrom.ca> <4E816E27.8040005@redhat.com> <201109271604.41502.thomas@fjellstrom.ca> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Avi Kivity , kvm@vger.kernel.org To: Thomas Fjellstrom Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52484 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752058Ab1I1HlW (ORCPT ); Wed, 28 Sep 2011 03:41:22 -0400 Content-Disposition: inline In-Reply-To: <201109271604.41502.thomas@fjellstrom.ca> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Sep 27, 2011 at 04:04:41PM -0600, Thomas Fjellstrom wrote: > On September 27, 2011, Avi Kivity wrote: > > On 09/27/2011 03:29 AM, Thomas Fjellstrom wrote: > > > I just noticed something interesting, a virtual machine on one of my > > > servers seems to have 69 threads (including the main thread). Other > > > guests on the machine only have a couple threads. > > > > > > Is this normal? or has something gone horribly wrong? > > > > It's normal if the guest does a lot of I/O. The thread count should go > > down when the guest idles. > > Ah, that would make sense. Though it kind of defeats assigning a vm a single > cpu/core. A single VM can now DOS an entire multi-core-cpu server. It pretty > much pegged my dual core (with HT) server for a couple hours. You can mitigate these problems by putting each KVM process in its own cgroup, and using the 'cpu_shares' tunable to ensure that each KVM process gets the same relative ratio of CPU time, regardless of how many threads it is running. With newer kernels there are other CPU tunables for placing hard caps on CPU utilization of the process as a whole too. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|