atom feed22 messages in org.freebsd.freebsd-performanceMassive performance loss from OS::sle...
FromSent OnAttachments
Kris KennawaySep 15, 2007 10:49 am 
Kris KennawaySep 15, 2007 12:08 pm 
Daniel EischenSep 15, 2007 3:37 pm 
Daniel EischenSep 15, 2007 9:47 pm 
Kip MacySep 15, 2007 10:52 pm 
Kris KennawaySep 16, 2007 3:16 am 
Daniel EischenSep 16, 2007 8:45 am 
Kurt MillerSep 16, 2007 9:06 am 
Kurt MillerSep 16, 2007 9:06 am 
Kip MacySep 16, 2007 12:56 pm 
Alfred PerlsteinSep 16, 2007 6:16 pm 
Kurt MillerSep 16, 2007 6:47 pm 
David XuSep 16, 2007 7:33 pm 
Kurt MillerSep 18, 2007 4:21 am 
Daniel EischenSep 18, 2007 5:29 am 
Kurt MillerSep 18, 2007 7:15 am 
Daniel EischenSep 18, 2007 10:08 am 
Kurt MillerSep 18, 2007 10:28 am 
Daniel EischenSep 18, 2007 11:00 am 
Kris KennawaySep 18, 2007 12:16 pm 
Kurt MillerSep 18, 2007 7:12 pm 
Kris KennawaySep 19, 2007 3:16 am 
Subject:Massive performance loss from OS::sleep hack
From:Kris Kennaway (kr@FreeBSD.org)
Date:Sep 15, 2007 10:49:55 am
List:org.freebsd.freebsd-performance

Hi,

I have been running the volano java benchmark (http://www.volano.com/benchmarks.html) on an 8-core i386 system, and out of the box jdk15 on FreeBSD performs extremely poorly. The system is more than 90% idle, and profiling shows that the ~800 threads in the benchmark are spending most of their time doing short nanosleep() calls.

I traced it to the following FreeBSD-specific hack in the jdk:

// XXXBSD: understand meaning and workaround related to yield ... // XXXBSD: done differently in 1.3.1, take a look int os::sleep(Thread* thread, jlong millis, bool interruptible) { assert(thread == Thread::current(), "thread consistency check"); ...

if (millis <= 0) { // NOTE: workaround for bug 4338139 if (thread->is_Java_thread()) { ThreadBlockInVM tbivm((JavaThread*) thread); // BSDXXX: Only use pthread_yield here and below if the system thread // scheduler gives time slices to lower priority threads when yielding. #ifdef __FreeBSD__ os_sleep(MinSleepInterval, interruptible); #else pthread_yield(); #endif

When I removed this hack (i.e. revert to pthread_yield()) I got an immediate 7-fold performance increase, which brings FreeBSD performance on par with Solaris.

What is the reason why this code is necessary? Does FreeBSD's sched_yield() really have different semantics to the other operating systems, or was this a libkse bug that was being worked around?

Kris