mirror of https://github.com/tikv/client-java.git
Change threshold
This commit is contained in:
parent
d2f5f4a238
commit
6b360b980c
|
|
@ -56,7 +56,7 @@ import sun.nio.ch.ChannelPerf;
|
|||
/** {@link io.netty.channel.socket.SocketChannel} which uses NIO selector based implementation. */
|
||||
public class NioSocketChannel extends AbstractNioByteChannel
|
||||
implements io.netty.channel.socket.SocketChannel {
|
||||
private static final double SLOW_IO_THRESHOLD = 0.01;
|
||||
private static final long SLOW_IO_THRESHOLD = 10_000_000;
|
||||
public static final Histogram socketWriteDuration =
|
||||
HistogramUtils.buildDuration()
|
||||
.name("netty_nio_socket_channel_write_duration_seconds")
|
||||
|
|
@ -392,11 +392,12 @@ public class NioSocketChannel extends AbstractNioByteChannel
|
|||
final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
|
||||
int attemptedBytes = byteBuf.writableBytes();
|
||||
allocHandle.attemptedBytesRead(attemptedBytes);
|
||||
Histogram.Timer socketReadTime = socketReadDuration.startTimer();
|
||||
SocketChannel sc = javaChannel();
|
||||
Histogram.Timer socketReadTime = socketReadDuration.startTimer();
|
||||
long start = System.nanoTime();
|
||||
int localReadBytes = byteBuf.writeBytes(sc, allocHandle.attemptedBytesRead());
|
||||
double duration = socketReadTime.observeDuration();
|
||||
if (duration > SLOW_IO_THRESHOLD) {
|
||||
if (System.nanoTime() - start >= SLOW_IO_THRESHOLD) {
|
||||
// read slower than 10ms is strange
|
||||
System.out.println(
|
||||
"[slow io] read "
|
||||
|
|
@ -478,9 +479,10 @@ public class NioSocketChannel extends AbstractNioByteChannel
|
|||
int attemptedBytes = buffer.remaining();
|
||||
socketWriteBytes.observe(attemptedBytes);
|
||||
Histogram.Timer writeTime = socketWriteDuration.startTimer();
|
||||
long start = System.nanoTime();
|
||||
final int localWrittenBytes = ch.write(buffer);
|
||||
double duration = writeTime.observeDuration();
|
||||
if (duration > SLOW_IO_THRESHOLD) {
|
||||
if (System.nanoTime() - start >= SLOW_IO_THRESHOLD) {
|
||||
// read slower than 10ms is strange
|
||||
System.out.println(
|
||||
"[slow io] write "
|
||||
|
|
@ -516,9 +518,10 @@ public class NioSocketChannel extends AbstractNioByteChannel
|
|||
long attemptedBytes = in.nioBufferSize();
|
||||
socketWriteBytes.observe(attemptedBytes);
|
||||
Histogram.Timer writeTime = socketWriteDuration.startTimer();
|
||||
long start = System.nanoTime();
|
||||
final long localWrittenBytes = ch.write(nioBuffers, 0, nioBufferCnt);
|
||||
double duration = writeTime.observeDuration();
|
||||
if (duration > SLOW_IO_THRESHOLD) {
|
||||
if (System.nanoTime() - start >= SLOW_IO_THRESHOLD) {
|
||||
// read slower than 10ms is strange
|
||||
System.out.println(
|
||||
"[slow io] write "
|
||||
|
|
|
|||
Loading…
Reference in New Issue