简体   繁体   中英

profiling nodejs high cpu usage ( indicates ___inc_remove_counter )

My test setup (Mocha + Karma) started taking 60% to 70% cpu consistently in idle/watch mode. I run it like

NODE_ENV=test node_modules/.bin/karma start build/testing/karma.conf.js --no-single-run --auto-watch 

I upgraded node from 5.x -> 6.2 today, but didn't have the high cpu till now (after using 6 hours). I ran profile as explained here . and these are the logs

 [Summary]:
   ticks  total  nonlib   name
  12260   14.8%   16.4%  JavaScript
  57135   69.0%   76.5%  C++
   2712    3.3%    3.6%  GC
   8112    9.8%          Shared libraries
   5318    6.4%          Unaccounted

[C++]:
   ticks  total  nonlib   name
  36120   43.6%   48.3%  ___inc_remove_counter
   1151    1.4%    1.5%  node::InitFs(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)
    967    1.2%    1.3%  _malloc_jumpstart
    819    1.0%    1.1%  v8::internal::IncrementalMarking::UpdateMarkingDequeAfterScavenge()
[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
  36120   43.6%  ___inc_remove_counter

   5318    6.4%  UNKNOWN

   4923    5.9%  /usr/local/bin/node
    579   11.8%    v8::internal::Builtins::~Builtins()
    166   28.7%      LazyCompile: ~Socket._writeGeneric net.js:654:42

 [C++ entry points]:
   ticks    cpp   total   name
   4637   25.0%    5.6%  v8::internal::Builtins::~Builtins()
   2385   12.8%    2.9%  v8::internal::Runtime_GetProperty(int, v8::internal::Object**, v8::internal::Isolate*)
   1943   10.5%    2.3%  v8::internal::Runtime_KeyedStoreIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
    966    5.2%    1.2%  v8::internal::Runtime_KeyedLoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
    881    4.7%    1.1%  v8::internal::Runtime_CompileOptimized_Concurrent(int, v8::internal::Object**, v8::internal::Isolate*)
    699    3.8%    0.8%  v8::internal::Runtime_HasOwnProperty(int, v8::internal::Object**, v8::internal::Isolate*)
    626    3.4%    0.8%  v8::internal::Runtime_WeakCollectionSet(int, v8::internal::Object**, v8::internal::Isolate*)
    562    3.0%    0.7%  v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*)
    488    2.6%    0.6%  v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*)
    416    2.2%    0.5%  v8::internal::Runtime_HasProperty(int, v8::internal::Object**, v8::internal::Isolate*)
    409    2.2%    0.5%  v8::internal::Runtime_LoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
    373    2.0%    0.5%  v8::internal::Runtime_StringCharCodeAtRT(int, v8::internal::Object**, v8::internal::Isolate*)
    313    1.7%    0.4%  ___inc_remove_counter

what is ___inc_remove_counter ?? how can I identify what is causing high cpu?

thanks.

Though i cleared ny node_moules and reinstalled all the dependencies, I still had the issue. It was solved by clearing cache npm cache clean and then reinstalling all deps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM