jjzjj

node.js - nodejs分析未知和下落不明的结果

coder 2023-05-29 原文

我正在运行 nodejs 4.4.7 LTS

我按照此处 https://nodejs.org/en/docs/guides/simple-profiling/ 的说明运行分析器:

node --prof app.js

然后:

node --prof-process isolate-something-v8.log > processed.txt

我错过了探查器的东西吗?

代码是关于什么的:

NodeJS 应用程序是 socket.io 服务器将数据从 WEB 发送到 C++ 应用程序,反之亦然。

您可以从下面的结果中看到,这里有大量未计入的抽动。在这种情况下,什么可能导致这种情况以及如何知道我的应用程序的瓶颈是什么?有什么解决办法?

Code move event for unknown code: 0x61047523c0
Code move event for unknown code: 0x6104bf74a0
Statistical profiling result from isolate-000001E1507CF2D0-v8.log,     (211705 ticks, 210634 unaccounted, 0 excluded).

 [Shared libraries]:
   ticks  total  nonlib   name

 [JavaScript]:
   ticks  total  nonlib   name
     71    0.0%    0.0%  LazyCompile: *stringToBuffer *SOMETHING*\socket.io\node_modules\engine.io\node_modules\engine.io-parser\lib\index.js:359:24
     59    0.0%    0.0%  LazyCompile: listOnTimeout timers.js:56:23
     50    0.0%    0.0%  LazyCompile: *wrapper timers.js:274:19
     43    0.0%    0.0%  Stub: StringAddStub_CheckNone_NotTenured

    .
    .
    .


[C++]:
   ticks  total  nonlib   name

 [Summary]:
   ticks  total  nonlib   name
   1071    0.5%    0.5%  JavaScript
      0    0.0%    0.0%  C++
    202    0.1%    0.1%  GC
      0    0.0%          Shared libraries
  210634   99.5%          Unaccounted

 [C++ entry points]:
   ticks    cpp   total   name

 [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
  210634   99.5%  UNKNOWN

最佳答案

始终更新到您正在使用的任何软件的最新稳定版本,Node.js 4.4.7 已经有几年的历史了。

Node.js - a tale of two bugs”中的 Mike Ralphson 博客:

"It is important to run both commands with exactly the same version of Node.js.

Unfortunately, when I tried to profile converting a single file (which showed around a 100% increase in execution time), both Node.js 7.x and v8.0.0-test20170511830c4bf319 showed almost all the time as unaccounted: ...

Having exhausted my Node.js debugging skills, I asked what I could do to try and produce a minimal test-case, and if there were any major anti-patterns which could result in much worse performance in Node.js 7 and 8.

I was at this stage convinced that the problem lay either in ajv (the library used to validate JSON schemas in swagger2openapi) or should.js (the BDD test/assertion library I was using).

Ben Noordhuis 补充说,以下命令将提供更深入的分析信息,特别是哪些功能被取消优化,以及原因:

 $ node8 --trace_opt --trace_deopt swagger2openapi petstore.json 

This pointed to two lines within should.js:

 ;;; deoptimize at <D:\nodejs\swagger2openapi\node_modules\should\cjs\should.js:152:14>, no cache

 ;;; deoptimize at <D:\nodejs\swagger2openapi\node_modules\should\cjs\should.js:68:14>, no cache 

That helped narrow it down, and I soon came up with a minimal test-case which showed the regressed behaviour.

 var should = require('should'); //11.2.0

 for (var i=0;i<10000;i++) {
     i.should.not.be.type('string');
 }

Node.js contributor Anna Henningsen reported that this was reproduceable.

...

He also offered to try and back-port the fix into v8 6.0 so it could be included in the current release stream of Node.js. This effort appears to have stalled however, but the good news is that the fix is already in the nightly builds of Node.js 9.0, which include v8 6.1.

The plan was to release Node.js 8.7 with v8 6.1, which should have fixed all my problems, however, a problem has been found with the v8 escape analysis which has had to be disabled in Node.js 8.7 - potentially making this release not as fast as I'd hoped. Whether the fix from v8 6.2 will make it into Node.js 8.x before it goes LTS (Long Term Support) is still a matter of conjecture, but I leave you with the comparative timings from my use-case for Node.js 6.11.4, 8.6.0, 8.7.0 and 9.0.0-nightly.

...

If you're using an exception-based assertion tool in your development environment, or any performance-critical code which depends on thrown error stack-traces, or just wondered where your performance went since Node.js 6.x, you should definitely consider upgrading to Node.js 8.7.

  • 更新您的工具链和 Nodejs。

  • 制作一个最小的测试用例来证明是否存在错误。

  • 阅读您正在使用的软件的错误报告、博客和已知问题。

我之前在 gcc 上遇到过类似的问题,未知并且没有深入到共享库中,我使用详细调试 (-ggdb IIRC) 重新编译了我的整个工具链,所以我可以看到所有内容。剥离很容易去除多余的。这个特殊的解决方案对很有用,因为我参与了测试和错误报告,可能对普通用户没有用,尽管它很容易拥有多个版本的工具链。

关于node.js - nodejs分析未知和下落不明的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38145769/

有关node.js - nodejs分析未知和下落不明的结果的更多相关文章

  1. 报告回顾丨模型进化狂飙,DetectGPT能否识别最新模型生成结果? - 2

    导读语言模型给我们的生产生活带来了极大便利,但同时不少人也利用他们从事作弊工作。如何规避这些难辨真伪的文字所产生的负面影响也成为一大难题。在3月9日智源Live第33期活动「DetectGPT:判断文本是否为机器生成的工具」中,主讲人Eric为我们讲解了DetectGPT工作背后的思路——一种基于概率曲率检测的用于检测模型生成文本的工具,它可以帮助我们更好地分辨文章的来源和可信度,对保护信息真实、防止欺诈等方面具有重要意义。本次报告主要围绕其功能,实现和效果等展开。(文末点击“阅读原文”,查看活动回放。)Ericmitchell斯坦福大学计算机系四年级博士生,由ChelseaFinn和Chri

  2. ruby-on-rails - 具有未知键和强参数的 Rails 哈希 - 2

    我有一个Rails应用程序,它在名为properties的字段中存储序列化哈希。虽然哈希键是未知的,所以我不知道有什么方法可以通过强参数实现这一点。谷歌搜索时,我发现了这个:https://github.com/rails/rails/issues/9454,但我想不出具体的解决方案。基本上,我的问题是:如何配置强参数以允许使用未知键的散列?感谢大家的帮助! 最佳答案 我最近遇到了同样的问题,我使用来自https://github.com/rails/rails/issues/9454的@fxn方法解决了它对于以properties

  3. ruby-on-rails - Assets 管道损坏 : Not compiling on the fly css and js files - 2

    我开始了一个新的Rails3.2.5项目,Assets管道不再工作了。CSS和Javascript文件不再编译。这是尝试生成Assets时日志的输出:StartedGET"/assets/application.css?body=1"for127.0.0.1at2012-06-1623:59:11-0700Servedasset/application.css-200OK(0ms)[2012-06-1623:59:11]ERRORNoMethodError:undefinedmethod`each'fornil:NilClass/Users/greg/.rbenv/versions/1

  4. ruby-on-rails - Rails - 理解 application.js 和 application.css - 2

    rails新手。只是想了解\assests目录中的这两个文件。例如,application.js文件有如下行://=requirejquery//=requirejquery_ujs//=require_tree.我理解require_tree。只是将所有JS文件添加到当前目录中。根据上下文,我可以看出requirejquery添加了jQuery库。但是它从哪里得到这些jQuery库呢?我没有在我的Assets文件夹中看到任何jquery.js文件——或者直接在我的整个应用程序中没有看到任何jquery.js文件?同样,我正在按照一些说明安装TwitterBootstrap(http:

  5. ruby - HTTP POST 上的 SSL 错误(未知协议(protocol)) - 2

    尝试通过SSL连接到ImgurAPI时出现错误。这是代码和错误:API_URI=URI.parse('https://api.imgur.com')API_PUBLIC_KEY='Client-ID--'ENDPOINTS={:image=>'/3/image',:gallery=>'/3/gallery'}#Public:Uploadanimage##args-Theimagepathfortheimagetoupload#defupload(image_path)http=Net::HTTP.new(API_URI.host)http.use_ssl=truehttp.verify

  6. node.js - 如何在 Travis CI 上的一个项目中运行 Node.js 和 Ruby 测试 - 2

    我有一个包含多个组件的存储库,其中大部分是用JavaScript(Node.js)编写的,一个是用Ruby(RubyonRails)编写的。我想要一个.travis.yml文件来触发一个运行每个组件的所有测试的构建。根据thisTravisCIGoogleGroupthread,目前还没有官方支持。我的目录结构是这样的:.├──构建服务器├──核心├──扩展├──网络应用├──流浪文件├──package.json├──.travis.yml└──生成文件我希望能够运行特定版本的Ruby(2.2.2)和Node.js(0.12.2)。我已经有了一个make目标,所以maketest在每

  7. 建模分析 | 平面2R机器人(二连杆)运动学与动力学建模(附Matlab仿真) - 2

    目录0专栏介绍1平面2R机器人概述2运动学建模2.1正运动学模型2.2逆运动学模型2.3机器人运动学仿真3动力学建模3.1计算动能3.2势能计算与动力学方程3.3动力学仿真0专栏介绍?附C++/Python/Matlab全套代码?课程设计、毕业设计、创新竞赛必备!详细介绍全局规划(图搜索、采样法、智能算法等);局部规划(DWA、APF等);曲线优化(贝塞尔曲线、B样条曲线等)。?详情:图解自动驾驶中的运动规划(MotionPlanning),附几十种规划算法1平面2R机器人概述如图1所示为本文的研究本体——平面2R机器人。对参数进行如下定义:机器人广义坐标

  8. 网站日志分析软件--让网站日志分析工作变得更简单 - 2

    网站的日志分析,是seo优化不可忽视的一门功课,但网站越大,每天产生的日志就越大,大站一天都可以产生几个G的网站日志,如果光靠肉眼去分析,那可能看到猴年马月都看不完,因此借助网站日志分析工具去分析网站日志,那将会使网站日志分析工作变得更简单。下面推荐两款网站日志分析软件。第一款:逆火网站日志分析器逆火网站日志分析器是一款功能全面的网站服务器日志分析软件。通过分析网站的日志文件,不仅能够精准的知道网站的访问量、网站的访问来源,网站的广告点击,访客的地区统计,搜索引擎关键字查询等,还能够一次性分析多个网站的日志文件,让你轻松管理网站。逆火网站日志分析器下载地址:https://pan.baidu.

  9. ABB-IRB-1200运动学分析MATLAB RVC工具分析+Simulink-Adams联合仿真 - 2

    一、机器人介绍        此处是基于MATLABRVC工具箱,对ABB-IRB-1200型号的微型机械臂进行正逆向运动学分析,并利Simulink工具实现对机械臂进行具有动力学参数的末端轨迹规划仿真,最后根据机械模型设计Simulink-Adams联合仿真。 图1.ABBIRB 1200尺寸参数示意图ABBIRB 1200提供的两种型号广泛适用于各作业,且两者间零部件通用,两种型号的工作范围分别为700 mm 和 900 mm,大有效负载分别为 7 kg 和5 kg。 IRB 1200 能够在狭小空间内能发挥其工作范围与性能优势,具有全新的设计、小型化的体积、高效的性能、易于集成、便捷的接

  10. 关于Qt程序打包后运行库依赖的常见问题分析及解决方法 - 2

    目录一.大致如下常见问题:(1)找不到程序所依赖的Qt库version`Qt_5'notfound(requiredby(2)CouldnotLoadtheQtplatformplugin"xcb"in""eventhoughitwasfound(3)打包到在不同的linux系统下,或者打包到高版本的相同系统下,运行程序时,直接提示段错误即segmentationfault,或者Illegalinstruction(coredumped)非法指令(4)ldd应用程序或者库,查看运行所依赖的库时,直接报段错误二.问题逐个分析,得出解决方法:(1)找不到程序所依赖的Qt库version`Qt_5'

随机推荐