Hacker News new | past | comments | ask | show | jobs | submit login

The implementation for promises is currently a pretty heavy performance hit:

https://docs.google.com/document/d/1y4lF-iQhhuSOgzlPIBbfCT4I...

The node and v8 teams are working to improve that, but the work hasn't all landed yet




It's not 100x as stated by the OP, but I wouldn't use it (async_hooks) in situations where performance is actually a concern. I wouldn't use node there either, but that's besides the point.

async_hooks are 100% usable in production right now, we use it at my current gig for tracing and its had minimal impact on the services using it.


No, they are not usable in production. We tried and was forced to rewrite whole app after this ASAP and eliminate usage of async hooks. We used them exactly same way: logs and some query-level context data.

Bluebird is bad for measuring async hooks because they have custom scheduler and most of the execution is done in single tick.

Overhead is for each tick, not each promise. If you have ~10 promises per request then you have N overhead if you will have 1000 promises you will get 100N overhead.

Our backend barely survived this after async hooks was just enabled and just disabling them make everything x100 faster.


Are you saying that async hooks perform fine with Bluebird but not native promises? Why not use Bluebird everywhere then?


Because this is not a solution, you still get penalty and bluebird is slower in latest nodejs versions.

Not really a long term solution.

We adapted approach with context from golang and now it works really well.


I see this "I'd never use node" sentiment quite a bit in the Java community. I'm always curious for the reason. Is it the JavaScript? or is Node unable to perform? After reading so many success stories from Netflix and Walmart, I'm wondering what the missing piece is....


Specifically in the area of high CPU load tasks. NodeJS is perfectly fine for heavily async tasks, especially calling out to external services. When you have CPU intensive tasks the lack of control over the event loop (task list) can be painful.


It’s not just Java, it’s any programmer with proficiency in any other language, including those that are quite proficient at JavaScript. The sentiment after our team wrapped up a recent Node project for a client was basically “the internet keeps lying about the maturity of the node ecosystem”. That was with the latest TypeScript and an architect who was very good.

The event loop model that Node uses is easily replicated in other programming languages. It’s not a sensible default though, blocking code is better for most domains.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: