New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
100% CPU when using SleepingWaitStrategy on 32 bit Linux #162
Comments
How many CPUs have you given your VM? |
How many threads/event handlers do you have running in your application? CPU usage can get quite high if the system is over contended. Also what does your Disruptor setup look like? It is possible to see high CPU usage if you have an event handler gating on another event handler that takes quite a long time to complete. |
Do you see the same behaviour when running with the BlockingWaitStrategy? |
Have you tried with a 2 CPU VM. |
@mikeb01 yes, with 2 CPU top in Irix mode reports 100% load. Which means that one CPU is fully loaded and second is free. |
It would also be useful if you could run a |
I notice that you are running a Linux guest on a Mac OS X host. Have you tried hosting the VM on a Linux server, e.g. on Amazon EC2? Also, what virtualisation tool are you using (e.g. VirtualBox)? |
VirtualBox was used. Same symptoms were observed for guests running on VMWare ESXi hypervisor. Have not tried with EC2. I will try to check it on other environments too. |
Were you still running with the Mac OS X host when using VMWare? |
I've tested with a 64 bit guest on KVM on Linux and I don't see the same issue. A spinning LockSupport.parkNanos tends to use 10% CPU. BTW, could you try just running the following code instead of the full Disruptor test. This will ensure that the problem is isolated to the LockSupport.parkNanos call.
|
I'll test tomorrow with a 32 bit guest on KVM. This will help determine if it is specifically an issue with being a 32 bit system. |
I have checked it both disruptor example and |
I've replicated the same issue with a 32 bit Linux guest on a 64 bit Linux host via KVM. Unfortunately there isn't anything that we can really do about it. If deploying onto a 32 bit guest is your only option, then I would recommend either the BlockWaitStrategy if you need to preserve CPU use, Yield/BusySpin if you need performance or some custom solution that many need to back off to a Thread.sleep(1) if the other solutions are not viable. The better recommendation would be to move to a 64 bit guest, which doesn't seem to exhibit the same issue. I'm not sure if this is an issue on 32 bit native hardware, but the last physical 32 bit machine in our environment was decommissioned about 5 years ago. I'm going to close this as a known issue, there is not much that we can do about it. |
@mikeb01 where can one find a list of known issues? |
I'll add a section to the Wiki. |
I did some digging through the JDK source while investigating this issue. The So there are 2 things happening here. On 64 bit it is able to get the current time without making an OS syscall (likely a property of libc), on 32 bit it has to make a syscall to get the current time. Also on 64 bit the FUTEX_WAIT_BITSET_PRIVATE option allows for filtering of matching bitset values on wait and wake. I suspect it is the former ( |
Thanks for sharing! |
hello, the same problem·
Thread 8745: (state = IN_JAVA)
8745 www 20 0 23.914g 4.441g 23468 R 99.9 7.1 21:31.39 java 26 core,linux 64 server |
Environment
Guest: Debian 7.11 kernel 3.2.0-4-486.
Host: Mac OS X x64.
Virtualization: VirtualBox.
Oracle JDK 1.8.0_92.
Disruptor 3.3.4.
Description
Check sample program. It seems that (un)famous
LockSupport.parkNanos(1L)
behaves differently on 64 and 32 bit kernels. On 32 bit Linux sleeping wait strategy behaves almost like busy spin.The text was updated successfully, but these errors were encountered: