Comments (4)
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.
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.
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.
Oh, ok, that will clearify most for me.
Thank you 👍
from napajs.
Related Issues (20)
- There's no napa-binding-v0.2.3-node-v51-win32-x64.tar.gz HOT 8
- There's no ./lib/index.js. HOT 2
- [centos 7.2]Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found HOT 2
- NapaJS for ethereum transactions HOT 2
- CreateZone:75 Failed to initialize zone HOT 2
- Use napajs as a secure sandbox? HOT 2
- not support --napa_binding_binary_host_mirror
- how does this lib compare to gpu.js ?
- coredump while running the tutorial
- can't find fuction 'foo' in module 'projectdir/test'
- Error: ReferenceError: setTimeout is not defined HOT 4
- is this the ruby killer we've been waiting for?
- CMake Error: Could not create named generator Visual Studio 15 2017 Win64 Win64 HOT 3
- install script set to release 67 but should be v64 HOT 1
- 1): no suitable image found. /napa-binding.node: unknown file type, first eight bytes:
- how child thread import vm
- Can i use napajs in only v8 enviroment without Nodejs?
- This repo is missing important files HOT 19
- Node v18 unavailable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from napajs.