Comments (11)
I ran node-inspector and used the V8 profiler to identify what the bottleneck is. As I suspected, all the time was spent JSON.stringify-ing the chunks (which were ~40kB each).
What's the fix? We have considered ditching JSON and sending pure binary over the socket. Your issue may get us to seriously implement that.
from now.
@sridatta, thanks for the debuging. Sending pure binary over the socket would result in a huge improvement in general and allow me to use now.js for this project as well. I hope this will get implemented.
from now.
It looks like something like BSON would be great. I am not sure whether it has been used before with socket.io, but it sounds very promising.
from now.
msgpack?
from now.
@dvv, looks interesting. Pgriess made what seems to be a pretty worked out library for it, see https://github.com/pgriess/node-msgpack
from now.
yep. for i fear workaround techniques used in socket.io won;t allow for pure binary data traffic.
from now.
Wow, msgpack is impressive. we'll do some tests and use that for serialization if it's as good as they are claiming.
from now.
Hmm. On my node.js setup JSON.parse is faster than msgpack.unpack.
from now.
@dvv, really? That's quite disappointing.
It's a true shame that Websockets do not allow binary transfer.
In that case I will limit my now.js usage to action and short message broadcasts, while for binary transfers (eg. files) I will respond to normal get requests.
from now.
I suppose you should first benchmark your setup. Plus, I guess chances are that for your static assets you'd still use a dedicated server
from now.
We've given this issue a lot of thought, and unfortunately there does't seem to be a simple solution.
The chunks take a long time because they have to be read into memory and then deserialized. Since the client-server communication is not a true tcp socket, we can't avoid that. Additionally msgpack isn't going to make anything faster because the binary has to be based64'ed to be transported anyways.
No good solution to this issue guys, closing. If someone comes up with any ideas, feel free to reopen
from now.
Related Issues (20)
- installation fail :( HOT 3
- Can not read the property of 'ressource' undefined HOT 1
- No dev in six months. What is the future of NowJS? HOT 13
- Now module Installation failed ..... throwing error in windows
- npm install now ..... throwing error HOT 1
- Not working with Dojo due to Socket.io-client
- Implementing chat module by using Nowjs HOT 6
- now.js and node autocluster core module
- Issue in limit of sending message in chat
- /nowjs/now.js ??
- website HOT 7
- Connecting to nodejs on http from https site HOT 1
- cannot finde module '../build/Release/nodeproxy.node'
- iOS app crashed in release mode while using Nowjs library
- Now doesn't work with latest sockets.io HOT 2
- Does not work with angular-cli: content.charCodeAt is not a function
- possible spam HOT 1
- Error: Cannot find module 'now' HOT 3
- Error: Cannot find module 'now'
- http://www.nowjs.com is not correct HOT 2
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 now.