Repository navigation
Re-create Selector if we hit the epoll(..) jdk bug which leads to 100% c... - #565
Conversation
…% cpu load. This is just a workaround but helps to recover. See #327
|
I think we should also do the same workaround for the boss thread of NioClientSocketChannel as this can also be effected. So it may be related to #535 |
There was a problem hiding this comment.
Why not use System.nanoTime? Its much cheaper, and also have have SelectorUtil.SELECT_WAIT_TIME_NANOS.
There was a problem hiding this comment.
Why is it cheaper? Maybe something to learn for me ;)
Sent from my iPhone. Excuse any typos....
Am 26.08.2012 um 13:20 schrieb Shay Banon [email protected]:
In src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java:
@@ -220,7 +253,32 @@ public void run() {
}try {
SelectorUtil.select(selector); Why not use System.nanoTime? Its much cheaper, and also have have SelectorUtil.SELECT_WAIT_TIME_NANOS.long beforeSelect = System.currentTimeMillis();—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
As far as I know (and I researched it a bit) System.nanoTime is cheaper OS call wise compared to System.currentTimeInMillis. Also, if you use nanoTime you get considerably better precision which is what you are after here (compute elapsed time).
There was a problem hiding this comment.
I read somwhere that System.nanoTime() is not really something you should rely on.
Let me try to remember where ;)
Beside that what you think of this workaround?
Sent from my iPhone. Excuse any typos....
Am 26.08.2012 um 13:54 schrieb Shay Banon [email protected]:
In src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java:
@@ -220,7 +253,32 @@ public void run() {
}try {
SelectorUtil.select(selector); As far as I know (and I researched it a bit) System.nanoTime is cheaper OS call wise compared to System.currentTimeInMillis. Also, if you use nanoTime you get considerably better precision which is what you are after here (compute elapsed time).long beforeSelect = System.currentTimeMillis();—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Hi there,
I'm bumping in because I'm very interested in this topic as I do a lot of
duration measurement on my own project.
From what I've read so far, nanoTime cost is much higher than
currentTimeMillis:
http://sharmaak.blogspot.fr/2012/08/systemnanotime-vs-systemcurrenttimemill.html
Cheers,
Stéphane
2012/8/26 Norman Maurer [email protected]
In src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java:
@@ -220,7 +253,32 @@ public void run() {
}try {
SelectorUtil.select(selector);long beforeSelect = System.currentTimeMillis();I read somwhere that System.nanoTime() is not really something you should
rely on. Let me try to remember where ;) Beside that what you think of this
workaround? Sent from my iPhone. Excuse any typos.... Am 26.08.2012 um
13:54 schrieb Shay Banon [email protected]:
… <#13962cfa73bb7d1c_>
In
src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java: >
@@ -220,7 +253,32 @@ public void run() { > } > > try { > -
SelectorUtil.select(selector); > + long beforeSelect =
System.currentTimeMillis(); As far as I know (and I researched it a bit)
System.nanoTime is cheaper OS call wise compared to
System.currentTimeInMillis. Also, if you use nanoTime you get considerably
better precision which is what you are after here (compute elapsed time). —
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/565/files#r1460786.
There was a problem hiding this comment.
I would still prefer nanoTime because it resists from system date shift.
The perf difference is negligible IMHO.
There was a problem hiding this comment.
the performance should not be the "key" point here as this should only be executed if we suspect the cpu bug here. So not quite often.. So If you guys thing nanoTime is the way to go I will be happy to change that ;)
I just would like to know what you think about the "workaround" in general ;)
There was a problem hiding this comment.
Ok switched to System.nanoTime()… Any other comments ?
Am 26.08.2012 um 16:17 schrieb Trustin Lee [email protected]:
In src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java:
@@ -220,7 +253,32 @@ public void run() {
}try {
SelectorUtil.select(selector); I would still prefer nanoTime because it resists from system date shift. The perf difference is negligible IMHO.long beforeSelect = System.currentTimeMillis();
—
Reply to this email directly or view it on GitHub.
|
General note, seems like this is one that people were hit by (jetty, mina), and I agree, this can definitely explain the 100% usage in the client socket, so +1 on getting this in (with the mentioned changes on check against nanos), and applying it also for the client boss. |
…eout to detect it to be more save. Thanks to @kimchy for spot this
|
@kimchy applied the changes you suggested. Thanks again for review :) |
|
If noone raise any more concerns I will just go aead an merge this into 3 and master |
There was a problem hiding this comment.
SELECT_TIMEOUT is in milliseconds, so to make it nanoseconds it should be multiplied by 1000000.
There was a problem hiding this comment.
I really need more sleep.. Let me fix this and merge in ;)
Sent from my iPhone. Excuse any typos....
Am 28.08.2012 um 11:22 schrieb Shay Banon [email protected]:
In src/main/java/org/jboss/netty/channel/socket/nio/SelectorUtil.java:
@@ -28,6 +28,9 @@
static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors() * 2;
- static final int SELECT_TIMEOUT = 10;
- static final int SELECT_TIMEOUT_NANOS = SELECT_TIMEOUT * 1000;
SELECT_TIMEOUT is in milliseconds, so to make it nanoseconds it should be multiplied by 1000000.—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Any reason why you call SelectionKey.cancel() twice?
There was a problem hiding this comment.
Nope.. Let me fix this.
…alls to SelectionKey.cancel()
|
@trustin ok code adjusted to address your comments. I will merge it to 3 and master.. Thanks! |
...pu load. This is just a workaround but helps to recover. See #327