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 <unistd.h>

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

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to