Will nodebb start multiple workers on a multiple core server?



  • Just want to know.


  • Admin Staff

    Right now no. We might look into it in the future though.



  • @baris
    So is there anyway I can use multiple processes to speed up?
    Like start two processes and use the nginx to do the load balance?


  • Admin Staff

    I believe we would have to change some of the code in core so you can start two instances that listen on different ports. Right now it listens on whatever is set in config.json.



  • @baris
    Thanks a lot for the quick response.
    Looking forward to that feature.


  • GNU/Linux Admin

    @CalPeterWu @baris Off-hand, I know that you may be able to use pm2 to run multiple instances of NodeBB listening on the same port. You may want to give that a shot.



  • So are these from the same NodeBB process? I assume that each loader starts an app -d?

    17357 user   20   0 1010M  119M  6448 S  0.0  6.5  0:03.39 /usr/local/bin/node ./app -d start
    17359 user   20   0 1010M  119M  6448 S  0.0  6.5  0:00.79 /usr/local/bin/node ./app -d start
    17360 user   20   0 1010M  119M  6448 S  0.0  6.5  0:00.81 /usr/local/bin/node ./app -d start
    17361 user   20   0 1010M  119M  6448 S  0.0  6.5  0:00.80 /usr/local/bin/node ./app -d start
    17362 user   20   0 1010M  119M  6448 S  0.0  6.5  0:00.83 /usr/local/bin/node ./app -d start
    17356 user   20   0 1010M  119M  6448 S  0.0  6.5  3:18.65 /usr/local/bin/node ./app -d start
    
    16514 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.00 /usr/local/bin/node /home/user/nodebb/loader -d start
    16515 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.00 /usr/local/bin/node /home/user/nodebb/loader -d start
    16516 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.00 /usr/local/bin/node /home/user/nodebb/loader -d start
    16517 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.00 /usr/local/bin/node /home/user/nodebb/loader -d start
    16518 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.00 /usr/local/bin/node /home/user/nodebb/loader -d start
    16513 user   20   0  683M 13952  5188 S  0.0  0.7  0:00.09 /usr/local/bin/node /home/user/nodebb/loader -d start
    

  • GNU/Linux Admin

    @Guiri Right, each loader instance starts an app instance. We may expand this so that the loader will spawn x-1 app.js instances, where x is the number of cores.



  • @julian Can you use standart NodeJS Cluster http://nodejs.org/api/cluster.html for multi-core as it seems to be a better solution. And it is better for NodeJS then use of pm2 or NginX to run on multi-cpu because of less overhead.


  • GNU/Linux Admin

    @dibu Yes, most likely would look into cluster module first before rolling my own solution 🙂


Log in to reply
 

Suggested Topics

  • 11
  • 16
  • 2
  • 19
  • 3
| |