5 ms·
I run a production node.js app and my experience hasn't been bad. My cofounder and I spent more time in the beginning (not much more time, mind you) learning ho
by mcs 14y ago
I run a production node.js app and my experience hasn't been bad. My cofounder and I spent more time in the beginning (not much more time, mind you) learning how to deal with multiple outstanding async calls, a good application structure for express, etc. Now it's just as fast for us to go in and add a new API call that does this one query in node as it would be in another system.
The only technical problem I've seen that node is an easier solution is dealing with third party apis concurrently. It wouldn't be very straightforward to have a redis query, a mongo query, a facebook query, and a sendgrid query all open at the same time and managing the results when they all come in (and keeping program flow maintainable) in PHP, Python, Ruby, etc. Probably not a common problem or desired feature, though.
We're 100% Node on heroku with a custom buildpack, using a hosted Mongo service, some Node written cron jobs (which were pretty interesting to write), and redis and we serve 5 digits worth of hits every day at least, and I'm more than happy with performance. I never once look back and regret the decision to use node. I don't necessarily care about sharing code, having frontend developers do everything, etc like some node guys throw around naively, but I am looking forward to bringing somebody on that can grasp adding in a new API route, throw in a Mongoose find, and render a template with some variables. We have EJS templates serverside and clientside for that reason, and that could just as easily be done in PHP or Python.
However, I am enjoying working with node, the node community, and the interesting modules and stuff that are being released. I will say that there's a good bit more active "lets hack this up into a module and open source it over the weekend" kind of people in node than others at the moment.
- dc-tech-fan 14y ago> The only technical problem where I've seen node be a unique solution is dealing with third party apis concurrently. Use a library like Async, it makes this really easy. https://github.com/caolan/async https://github.com/caolan/async (assume redis, mongo, facebook, and callback are all functions) async.parallel([ redis, mongo, facebook], callback); callback is called when all of the others are complete. If you have dependencies, like facebook needs the output of redis and mongo then use async.auto which will automatically run things in parallel and in the order you need them.
- mcs 14y agoYes, what I was saying is that Node makes that really simple, and PHP, Python, Ruby, etc don't. That's more of a side effect of having everything be asynchronous though.
- anonymoushn 14y agoThis is really simple in Python using greenlet, stackless, or gevent.
- falcolas 14y agoOr threads. Simple, non-shared state threads are not that difficult to write, and for IO bound operations, they are not terribly inefficient.