Node.js性能下降,随机延迟峰值

时间:2016-05-08 12:08:22

标签: node.js

我有一个节点(v0.10.45)应用程序已经运行了很长时间没有问题(没有内存泄漏,代码逻辑清理)。

它最近开始表现得很奇怪,在任意位置暂停。暂停显然没有连接到任何特定的代码/数据行。因此,虽然暂停发生很多,但它们发生在不同的地方,使得它们很难完全重现!

即使正常响应时间小于50毫秒,某些请求现在也需要> 10,000毫秒并因此而超时。该应用程序无法使用。

该应用程序创建了许多小对象,所以我的预感是这些随机峰值以某种方式连接到垃圾收集。所以我将--trace_gc --trace_gc_verbose添加到节点CLI参数中,并在滞后位周围看到它:

[24379] All spaces,         used: 1328265 KB, available:  73223 KB, committed: 1419167 KB
[24379] Total time spent in GC  : 27640 ms
[24379]   283287 ms: Mark-sweep 1363.9 (1458.1) -> 1335.8 (1458.1) MB, 4208 ms [allocation failure] [promotion limit reached].
[24379] Memory allocator,   used: 1493104 KB, available:   6032 KB
[24379] New space,          used:      1 KB, available:  16382 KB, committed:  32768 KB
[24379] Old pointers,       used: 693370 KB, available:  55840 KB, committed: 749270 KB
[24379] Old data space,     used: 482911 KB, available:  11581 KB, committed: 494997 KB
[24379] Code space,         used:    775 KB, available:    497 KB, committed:   1992 KB
[24379] Map space,          used:    333 KB, available:    802 KB, committed:   1135 KB
[24379] Cell space,         used:     25 KB, available:    102 KB, committed:    128 KB
[24379] Large object space, used: 190467 KB, available:   4991 KB, committed: 191377 KB
[24379] All spaces,         used: 1367884 KB, available:  85208 KB, committed: 1471668 KB
[24379] Total time spent in GC  : 31848 ms
[24379]   287770 ms: Mark-sweep 1363.6 (1470.2) -> 1345.4 (1470.2) MB, 4313 ms [Runtime::PerformGC] [scavenge might not succeed].
[24379] Memory allocator,   used: 1505472 KB, available:      0 KB
[24379] New space,          used:      1 KB, available:  16382 KB, committed:  32768 KB
[24379] Old pointers,       used: 690545 KB, available:  58281 KB, committed: 749270 KB
[24379] Old data space,     used: 483262 KB, available:  11367 KB, committed: 494997 KB
[24379] Code space,         used:    775 KB, available:   1216 KB, committed:   1992 KB
[24379] Map space,          used:    333 KB, available:    802 KB, committed:   1135 KB
[24379] Cell space,         used:     25 KB, available:    102 KB, committed:    128 KB
[24379] Large object space, used: 202755 KB, available:      0 KB, committed: 203730 KB
[24379] All spaces,         used: 1377698 KB, available:  88154 KB, committed: 1484021 KB
[24379] Total time spent in GC  : 36161 ms
[24379]   292175 ms: Mark-sweep 1373.2 (1482.3) -> 1354.9 (1482.3) MB, 4238 ms [Runtime::PerformGC] [scavenge might not succeed].
[24379] Memory allocator,   used: 1517840 KB, available:      0 KB
[24379] New space,          used:      1 KB, available:  16382 KB, committed:  32768 KB
[24379] Old pointers,       used: 687696 KB, available:  61354 KB, committed: 749270 KB
[24379] Old data space,     used: 483549 KB, available:  11228 KB, committed: 494997 KB
[24379] Code space,         used:    759 KB, available:   1232 KB, committed:   1992 KB
[24379] Map space,          used:    333 KB, available:    802 KB, committed:   1135 KB
[24379] Cell space,         used:     25 KB, available:    102 KB, committed:    128 KB
[24379] Large object space, used: 215043 KB, available:      0 KB, committed: 216083 KB
[24379] All spaces,         used: 1387407 KB, available:  91103 KB, committed: 1496374 KB
[24379] Total time spent in GC  : 40399 ms
[24379]   296685 ms: Mark-sweep 1370.7 (1482.3) -> 1355.4 (1482.3) MB, 4359 ms [Runtime::PerformGC] [scavenge might not succeed].
[24379] Memory allocator,   used: 1517840 KB, available:      0 KB
[24379] New space,          used:      1 KB, available:  16382 KB, committed:  32768 KB
[24379] Old pointers,       used: 687918 KB, available:  60586 KB, committed: 749270 KB
[24379] Old data space,     used: 483840 KB, available:  11097 KB, committed: 494997 KB
[24379] Code space,         used:    764 KB, available:   1227 KB, committed:   1992 KB
[24379] Map space,          used:    333 KB, available:    802 KB, committed:   1135 KB
[24379] Cell space,         used:     25 KB, available:    102 KB, committed:    128 KB
[24379] Large object space, used: 215043 KB, available:      0 KB, committed: 216083 KB
[24379] All spaces,         used: 1387926 KB, available:  90199 KB, committed: 1496374 KB
[24379] Total time spent in GC  : 44758 ms
[24379]   301230 ms: Mark-sweep 1383.1 (1494.3) -> 1364.9 (1494.3) MB, 4375 ms [Runtime::PerformGC] [scavenge might not succeed].

知道怎么读这个吗?

问题是什么,如何解决?

0 个答案:

没有答案