performance - Node API 占用 100% CPU,node-tick-processor 输出看起来很神秘

标签 performance node.js api debugging

我有一个 Node API,通常可以很好地处理流量。然而,在我们的高峰时间,它会进入这种状态,开始使用 100% CPU 并且需要重新启动。重启后,接下来几天恢复正常状态。

使用负载测试站点,我已经能够重现此问题。我负载测试的请求非常简单,所以我担心问题出在我正在使用的第三方库中。

我是调试 Node 的新手,我不确定如何处理 Node 滴答处理器的以下输出。谁能破译这个?

更新:我正在运行 Node v0.10.4

[Unknown]:
ticks  total  nonlib   name
   5    0.0%

[Shared libraries]:
ticks  total  nonlib   name
11943   49.1%    0.0%  /lib64/libc-2.12.so
10754   44.2%    0.0%  /usr/local/bin/node
  314    1.3%    0.0%  /lib64/libpthread-2.12.so
   50    0.2%    0.0%  7fff318b4000-7fff318b5000
    5    0.0%    0.0%  /lib64/libm-2.12.so
    3    0.0%    0.0%  /usr/lib64/libstdc++.so.6.0.17

[JavaScript]:
ticks  total  nonlib   name
 40    0.2%    3.2%  LazyCompile: ~read tls.js:397
 36    0.1%    2.8%  LazyCompile: *EventEmitter.addListener events.js:126
 29    0.1%    2.3%  LazyCompile: *Readable.read _stream_readable.js:226
<clipped>

[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 2.0% are not shown.

ticks parent  name
11943   49.1%  /lib64/libc-2.12.so
10754   44.2%  /usr/local/bin/node
 8270   76.9%    LazyCompile: *use tls.js:222
 5162   62.4%      LazyCompile: ~read tls.js:397
 5074   98.3%        LazyCompile: *Readable.read _stream_readable.js:226
 3396   66.9%          LazyCompile: ~write tls.js:315
 3396  100.0%            LazyCompile: *Writable.write _stream_writable.js:155
 1063   20.9%          LazyCompile: *write tls.js:315
 1063  100.0%            LazyCompile: *Writable.write _stream_writable.js:155
 370    7.3%          LazyCompile: *Writable.write _stream_writable.js:155
 370  100.0%            LazyCompile: ~write _stream_readable.js:546
 186    3.7%          LazyCompile: ~callback tls.js:753
 180   96.8%            LazyCompile: *onclienthello tls.js:748
 6    3.2%            LazyCompile: ~onclienthello tls.js:748
 2417   29.2%      LazyCompile: *read tls.js:397
 2417  100.0%        LazyCompile: *Readable.read _stream_readable.js:226
 2320   96.0%          LazyCompile: *Writable.write _stream_writable.js:155
 2315   99.8%            LazyCompile: ~write _stream_readable.js:546
   57    2.4%          LazyCompile: ~callback tls.js:753
   57  100.0%            LazyCompile: *onclienthello tls.js:748
  691    8.4%      LazyCompile: *Readable.read _stream_readable.js:226
  675   97.7%        LazyCompile: *write tls.js:315
  675  100.0%          LazyCompile: *Writable.write _stream_writable.js:155
  674   99.9%            LazyCompile: ~write _stream_readable.js:546

最佳答案

对于那些仍然来到这里的人来说,这是由系统 Node 模块中的 SSL 处理代码中的某个地方引起的。我重新配置了我的堆栈以在 nginx 上执行 SSL 终止,并在 Node 级别使用基本的 HTTP 处理,这个问题完全消失了。

关于performance - Node API 占用 100% CPU,node-tick-processor 输出看起来很神秘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17659682/

相关文章:

node.js - 安装node.js后npm -v报错

php - Twitter api 1.1 图像未显示在提要中

django - 如何解决错误 'RelatedManager'对象不可下标?

Python:一旦找到真值,any() 是否会停止迭代列表/生成器?

oracle - 将 InitialLOBFetchSize 与 EntityFramework 结合使用

java - 如何监控 Java 进程的性能?

java - 在这种情况下,当仅调整图像(png)大小时,BitmapFactory 真的有必要吗?

javascript - Travis 失败,状态码为 127

java - dyld : Symbol not found: _JNI_CreateJavaVM

android - 谷歌网址缩短器 API 错误(403 禁止)[更新]