jsha / blocktogether

Share your blocks and subscribe to others'
GNU General Public License v3.0
330 stars 68 forks source link

Migrate to node v0.12 #188

Closed jsha closed 9 years ago

jsha commented 9 years ago

This may improve CPU usage for stream.js a lot, since it will pull in https://github.com/joyent/node/commit/934bfe23a16556d05bfb1844ef4d53e8c9887c3d, the fix for _unrefActive being slow: https://github.com/joyent/node/wiki/Optimizing-_unrefActive

Profiling shows _unrefActive as the dominant item:

   ticks parent  name
  1370294   75.5%  /lib/x86_64-linux-gnu/libc-2.19.so
  256181   14.1%  LazyCompile: *exports._unrefActive timers.js:425
  57133    3.1%  /usr/lib/libv8.so.3.14.5
  49040    2.7%  /usr/bin/nodejs

The libc.so ticks are probably mostly in epoll, since stream.js was taking about 20% of CPU when measured. Of that ~20% of CPU, 14.1 / (14.1 + 3.1 + 2.7) = 71% of it was used by _unrefActive.

jsha commented 9 years ago

Tried upgrading to node v0.12. Required updating upnode to depend on newer version that depended on newer version of dnode. Note: modules must be installed using version of node they will be run with.

For some reason socket.unref in setup.js get an undefined error under node v0.12. Resolved by removing it, but should find a better way, because removing that unref will inhibit clean shutdown.

jsha commented 9 years ago

Fixed.