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.
  • 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.
  • 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
    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
    @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
Add Comment