From owner-freebsd-stable@FreeBSD.ORG Tue Sep 6 03:17:20 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A251416A41F for ; Tue, 6 Sep 2005 03:17:20 +0000 (GMT) (envelope-from tom@band-ade.com) Received: from stan.phonebites.com (stan.phonebites.com [209.133.33.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4640343D48 for ; Tue, 6 Sep 2005 03:17:20 +0000 (GMT) (envelope-from tom@band-ade.com) Received: from localhost (localhost.phonebites.com [127.0.0.1]) by stan.phonebites.com (Postfix) with ESMTP id 93F62A9FC83 for ; Mon, 5 Sep 2005 20:17:19 -0700 (PDT) Received: from stan.phonebites.com ([127.0.0.1]) by localhost (stan.phonebites.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 85011-06 for ; Mon, 5 Sep 2005 20:17:17 -0700 (PDT) Received: from [192.168.1.2] (user177-63.wireless.ocsnet.net [208.19.63.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by stan.phonebites.com (Postfix) with ESMTP id 8A7BAA9FC5E for ; Mon, 5 Sep 2005 20:17:17 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v733) Content-Transfer-Encoding: 7bit Message-Id: <7244231F-36BE-442A-9802-EE08DA4B8BC5@band-ade.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-stable@freebsd.org From: Tom Pepper Date: Mon, 5 Sep 2005 20:17:14 -0700 X-Mailer: Apple Mail (2.733) X-Virus-Scanned: amavisd-new at phonebites.com Subject: nanosleep/usleep using cpu under vmware esx X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 03:17:20 -0000 Y'all: I'm running a few instances of 5-stable under VMWare ESX 2.51 on several dual-processor HP BL20P 3Ghz+ Xeon servers. The system load runs normally for network processes like apache and mysql, but for any process which utilizes nanosleep() or usleep() in a while loop there's between 1-2% of CPU consumed, even when the processes have no tasks performing beside the sleep. Running the same processes on actual hardware in an identical configuration (5-STABLE on physical blade) shows no CPU load. My grasp of programming is far from wide-reaching, but I've gone so far as to compile a simple program. Please don't laugh within earshot: #include int main() { int i; for(i=0; i<1000; i++) { usleep(2000); } return 0; } A few results after compiling (-O2 -s) and executing within /usr/bin/ time: inside VMWare-hosted 5-stable host: 0.044u 0.050s 0:19.62 0.4% 53+834k 0+0io 0pf+0w 0.029u 0.054s 0:19.60 0.3% 24+810k 0+0io 0pf+0w 0.036u 0.057s 0:19.60 0.4% 29+973k 0+0io 0pf+0w 0.037u 0.053s 0:19.59 0.4% 32+1072k 0+0io 0pf+0w outside VMWare within 5-stable on same hardware: 0.006u 0.006s 0:19.99 0.0% 0+0k 0+0io 0pf+0w 0.000u 0.012s 0:19.99 0.0% 12+396k 0+0io 0pf+0w 0.002u 0.010s 0:19.99 0.0% 20+660k 0+0io 0pf+0w 0.004u 0.008s 0:19.99 0.0% 0+0k 0+0io 0pf+0w I'm assuming this has something to do with the fact that vmware's concept of time differs from being on the wire, but I'm wondering if there's anything I can do to reduce sleep CPU consumption of software designed around this concept (streaming servers, etc.)? Would this question be better-addressed in another list? Thanks, -Tom