我正在使用netty nio在单台计算机上进行客户端服务器通信。

在某些Windows 2003计算机上,相同的客户端/服务器程序可以在许多服务器上正常工作。

如果服务器未运行,并且客户端尝试进行连接(在某些超时后异常产生预期结果),则服务器上的中断数将急剧增加。

通常,中断数量(如Windows Performance gui所示)平均为300 / s。当客户端尝试连接中断时,其速率大约为1000 / s。

只要客户端正在运行,中断就保持高电平,即使它不尝试重新连接,并且一旦能够连接就保持高电平。

如果客户端可以在第一次尝试时连接到服务器,则不会发生这种情况。

增加的中断计数会导致服务器时钟发生强烈漂移。

关于正在发生的事情以及如何避免的任何想法或建议?

看完之后:
http://blogs.technet.com/b/markrussinovich/archive/2008/04/07/3031251.aspx

我运行KernRate具有以下结果:

当客户端尝试连接时:

P0     K 0:00:00.015 ( 0.2%)  U 0:00:00.031 ( 0.4%)  I 0:00:07.265 (99.4%)  DPC
 0:00:00.000 ( 0.0%)  Interrupt 0:00:00.000 ( 0.0%)
   Interrupts= 6117, Interrupt Rate= 837/sec.


Context Switches     ,       307153,         42004/sec.
System Calls         ,       404125,         55265/sec.
Page Faults          ,         1050,         144/sec.
I/O Read Operations  ,          143,         20/sec.
I/O Write Operations ,          386,         53/sec.
I/O Other Operations ,         1407,         192/sec.
I/O Read Bytes       ,        14712,         103/ I/O
I/O Write Bytes      ,        49575,         128/ I/O
I/O Other Bytes      ,       182356,         130/ I/O


 Module                                Hits   msec  %Total  Events/Sec
 intelppm                              11144       7311    97 %    38106962
 ntoskrnl                                196       7311     1 %      670222
 hal                                      69       7311     0 %      235945
 win32k                                   53       7311     0 %      181233
 ramirr2                                   6       7311     0 %       20517
 afd                                       2       7311     0 %        6839
 tcpip                                     2       7311     0 %        6839
 Ntfs                                      1       7311     0 %        3419
 bxvbdx                                    1       7311     0 %        3419


当客户端进程未运行时:

P0     K 0:00:00.015 ( 0.3%)  U 0:00:00.000 ( 0.0%)  I 0:00:04.546 (99.7%)  DPC
 0:00:00.000 ( 0.0%)  Interrupt 0:00:00.000 ( 0.0%)
   Interrupts= 2213, Interrupt Rate= 485/sec.


                              Total      Avg. Rate
Context Switches     ,         9398,         2060/sec.
System Calls         ,        29104,         6379/sec.
Page Faults          ,         2158,         473/sec.
I/O Read Operations  ,          130,         28/sec.
I/O Write Operations ,          273,         60/sec.
I/O Other Operations ,          619,         136/sec.
I/O Read Bytes       ,        12029,         93/ I/O
I/O Write Bytes      ,        37754,         138/ I/O
I/O Other Bytes      ,        92840,         150/ I/O

 Module                                Hits   msec  %Total  Events/Sec
 intelppm                               7208       4561    99 %    39508879
 ntoskrnl                                 20       4561     0 %      109625
 win32k                                   10       4561     0 %       54812
 hal                                       4       4561     0 %       21925
 ramirr2                                   3       4561     0 %       16443
 tcpip                                     3       4561     0 %       16443
 Ntfs                                      1       4561     0 %        5481


-罗恩

最佳答案

错误356 - Bug in HashedWheelTimer.waitForNextTick() ?的错误修复中解决了此问题

此错误是由Windows在Java调用Thread.sleep()时生成中断引起的,如果时间少于10毫秒,则可以通过不休眠来解决此错误。

应用此更改后,中断率保持不变。

09-30 14:39
查看更多