Giter Club home page Giter Club logo

Comments (4)

fs-eire avatar fs-eire commented on May 23, 2024

When talking about performance, it's always depending on a lot of things, the spec of the machine (CPU cores, memory and so on), the services and applications running on the machines, and how the code is written.

To understand how napa.js helps the performance improvement, it is important to understand the Node.js's event loop model. async IO is introduced to help to get rid of blocking IO, but all javascript code are running in the main thread. this may not be an issue for a typical Node.js application, which usually does not have a heavy process per request.

If you have the requirement of heavy process pre request, say, you need to do something using javascript which spend 0.1 seconds per request, this means you won't be able to handle more than 10 request per seconds. This is when napa.js or node clusters come to the scope.

to answer your question:
1- it depends on what your application do and how it is implemented. Napa.js helps when you javascript code spend a lot of time. please do profiling and check the result

2- the cost of napa.js contains the time cost and memory cost.
it does spend some time when the first time napa.js is loaded (require('napajs');) and has overhead for each call on zones. those number can be found in benchmark.
memory cost mainly depends on the module that you loaded into each worker. check the runtime memory consume statistics.
the recommended way of using napa.js is to delegate heavy tasks to zones, especially when those tasks are time-consuming CPU bounded javascript code.

from napajs.

 avatar commented on May 23, 2024

Thank you very much - i haven't recognized any data on overheads in the benchmark - maybe, my english is buggy. I will have a next look.

Would be nice if the issue can stay open a little time if others would like to talk about some experience.

Lastly, i got now to another question. Say, there is a node cluster with 4 workers and because of random requests, all workers using napa unsorted - is there something problematic?

from napajs.

fs-eire avatar fs-eire commented on May 23, 2024

napa.js and node cluster are 2 different solutions for the same problem: scalability -- napa.js via multi-thread and node cluster via multi-process.

in my opinion, you don't need to use 2 of them. I mean, you can use them both, that does not cause issue, but (likely) you do not gain benifit from doing this.

from napajs.

 avatar commented on May 23, 2024

Oh, ok, that will clearify most for me.

Thank you 👍

from napajs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.