7

Java Or NodeJS for building stable and scalable backend API

Comments
  • 0
    Depends on the backendes purpose /job.
  • 2
    Language preference is a big part of it these days - they're both well established (assuming Spring for Java) and can both likely do what you're asking of them.

    Only other things I'd consider are library support (if you have any particularly niche libraries that may be more available in one language than another), and if for any reason you're planning on deploying it on a FaaS (serverless) style infrastructure, the high cold start time of Java may make that prohibitive.
  • 2
    If you need performance choose java or golang. If you need performance with least cost of hardware choose golang. If you are experienced in js and dont care about performance choose node.
  • 5
    Node is still single-threaded. So, if your backend does anything but pure CRUD I would not choose Node.
    But then, since I don't like Javascript I wouldn't choose it anyway and rather use Go.
  • 1
    I love js but I never saw node in real enterprise and i guess you'll never see it.
  • 2
    Node has widespread usage across many enterprises, each with their testimony left of how it helped them scale where their previous stack did not. It is single threaded so it’s no computation heavy but most APIs are not. Most are focused on getting the data under a set of conditions and getting it back to your client. It’s non-blocking nature makes it ridiculously fast and unlike anything you’ve ever used. For strictly I/O it has destroyed Java’s benchmarks. Java still dominates in Computative heavy tasks though, that was until node gave the ability to spawn processes per cpu with ease. Now when you have a cpu heavy task, you can utilize as many processes as cores you have. On top of all of it, nodes easy to use and comes with all that NPM has become. It’s a great pick and I use it for very large projects every year.
  • 0
    Golang, but if I only have this two choices I‘d prefer Nodejs. Because Java is not nice and very slow in comparison.
  • 1
    @Sumafu while I also prefer JS, Java is actually faster. But yeah, Go seems like an awesome choice for almost anything web related.
  • 1
    What the fucks up with go. There’s not a single go positional available in a 500 mile span of my city.
  • 0
    @dUcKtYpEd Go is still too much of a niche, which makes it *horrendously* difficult and expensive to find & maintain a good development team.
  • 0
    @AlmondSauce yeah. But if you can find a job as Go dev, the pay can be amazing. Last month I had a job offer for someone woth 2 years of experience, paid the same as jobs for people with 6-7 in my country.
  • 0
    what's that special about go anyway?
  • 0
    I've switched to node instead of java - i use graphql server to orchestrate all data mutations and querying with legacy backends. Works just fine and scaling is not a real problem , for more compute heavy workloads - build native node module with rust or c++.
  • 0
    @Coffe2Code it's a pretty fun language, low level so performance is really good. Thers more to it, but maybe someone else has more time than me now
  • 0
    Ahhh yes and then we get into the fact that you can build node with c++ for peak performance reasons. Def node for the win. Go seems interesting though. I’d be interested in learning it but not until it holds market value in my region
  • 0
    I can't say for node.js but Java is a crap solution.

    Maybe it runs your destructors maybe it don't

    Then the GC will kick in and dos your whole stack.
  • 0
    @Sumafu Java is slower than node? Are you serious? Did you see any benchmarks or tested them yourself? Because I tested them all (node, php, java, go, python) just for benchmarks and java was better than node because you know node is interpreted and java is kinda compiled (you know jvm thing).
  • 0
    @hack you need to be more specific about what benchmarks your running. Each tool has its place and purpose. Java out does node on computation. Node destroys in I/O benchmarks. I’ve had to provide many studies on the two amongst 5 other languages/frameworks and databases when approaching a client with a solution. Java has its place. I/O heavy apis are not it’s place
  • 0
    @dUcKtYpEd well, I tested with single db connection per request and node wasn't passing any compiled language (as expected). I didn't tested file i/o but I think most applications doesn't require file i/o. So my tests was pure request per second with single db query withouth any computation.
  • 3
    I was a Java dev for years and Co-architected a multi service (microservice) platform in Java. I would chose node. Developing node is far faster because devs don't waste their time on making code overly typed with verbose generics and overly pretty patterns etc. These are fallacies which cost time especially in early days when requirements are fluid. In Node devs just think in flexible json. Json in json out. Free and fast. Java has a fairly hard scale ceiling and a memory hog. Both are good choices though.
  • 0
    @robsbobs yes that's a good point.
    but I'm questioning the ability of nodejs to handle sofesticated systems and specially when devs make dirty changea on the last minute, would it be safe and sample to handle, or the messy hell is faster to come
  • 1
    @Coffe2Code The sophistication of a language doesn't mean it is better at handling sophisticated scenarios. I find web services don't get too complex anyway. If they do then break them up. Devs can make crap of anything without testing, review and direction. What are the skills of the team and senior devs at present. Take that into account obviously. Also look at how easy it is to attract talent
  • 0
    @hack I mean we could go down that rabbit hole but it’s all contextual I was listening to a.net podcast the other day about how node still surpasses.net core for I/o. Now I know C-sharp/.net core surpasses Java/spring on almost all benchmarks. No it is not going to surpass on all levels as they have a purpose but all of the benchmark don’t lie. Walmart, nasa and countless other organizations testify to the scalability they’ve acquired with node. Scalability that they did not have with their traditional stacks. It’s tried and true
Your Job Suck?
Get a Better Job
Add Comment