2

Well, My firm has a CRM which is built on JSP and Java. They want to upgrade the frontend by using a modern technology. Which one is a great choice React or Angular?
For the backend, APIs need to be integrated and I need to select from PHP and NodeJS. The traffic right now is 100 hits/second and is expected to increase upto 1k/sec in 6months.

What is the best choice for the frontend, backend and I need to select a HTTP request client too.

Comments
  • 2
    Oh my. 1k requests per second and you want to go with php? Seriously? Java is perfectly fine with such loads. Not to mention, you want to do total rewrite grin the grounds up and change the whole technology stack. If you really need to drop jdk, choose nodejs, but you REALLY should stay where you are if it's a critical application.
    You can do a graceful shift from JSP to API+SPA with your current architecture.

    Depending on the complexity of the app, if you have deeply interconnected everything, use angular. If you can slowly extract more and more components, use react. Keep in mind that react itself is just "view" in "mvc" and needs other libs to work.
    It's easier to shift to react gracefully, without rewriting your app from scratch. On the other hand it's easier to maintain architecture with angular.
  • 0
    📌
  • 0
    Java will stay where it is and JSP will be replaced with React or Angular. But to connect the API I will need a backend language to send and receive CURL requests. So I'll need to select from PHP or NodeJS.

    One more thing is there any alternative to CURL to make the transfer faster. @mt3o
  • 0
  • 1
    @reflexgravity to be honest, I don't understand what you just wrote.
  • 0
    @mt3o I want a better alternative to cURL. Something fast.
  • 1
    Browser (react or angular) <-> cloudflare <-> your loadbalancer <-> tomcat (spring or something else)

    In the controller you have:

    A RequestMapping("/myEndpoint")
    A ResponseBody
    HashMap<String, Object> endpoint(Locale locale){

    ...

    }

    Note: A are used instead of @ for annotations to avoid calling users on devrant.
    Note: I'm typing this on my mobile phone.

    Spring, with help of Jackson, takes care of converting your hashmap into JSON which is fetched by your javascript. The hashmap contains whatever was pushed into the old Model for the JSP.

    CURL is a tool and library that makes http requests.
    What do you want to do with it? And where do want to put PHP or Node? Between loadbalancer and tomcat? It's pointless.
  • 1
    @reflexgravity your need curl for what, exactly?
  • 0
    Well the frontend is going to be written in a different Server. So to connect the APIs, I need cURL or similar.
  • 1
    Ok, i reviewed your cv and have an idea of what you might want to do. Your want to use it for testing purposes? If so, use Insomnia or Postman or SoapUI to fetch requests.
    You can establish e2e tests on javascript along your frontend code to automate it.
    Not to mention using unit and integration tests in Java.. Junit and Spring are awesome tools.

    For development, i'd suggest sticking to CLI. Learn bash (you have no experience with it, right?) and use httpie (or wget) together with jq or other json-friendly grep-analog.
  • 1
    @reflexgravity there is no valid point in pushing this to separate servers. Your js code can be cached by cloudflare or akamai, its static, after all. Adding another server to be used as a proxy adds useless workload with no real benefits. Perhaps you can set another tomcat or even nginx to serve static files (and be able to deploy them apart) but that's all.
  • 0
    @mt3o This is for production. Well I do have experience with bash, I'll take your suggestions. Thanks a ton. I have a better clarity now.
  • 0
    For production - just don't :) tomcat hidden behind cloudflare or akamai handles things better than anything else. And for non-static stuff, you have to pass the request to the tomcat one way or another.
    You can establish a simple benchmark and present it to your management to explain them that what they want to do is just adding overhead.
  • 0
    @mt3o ok. But due to the complex and dynamic UI, handling it with jQuery is messy. So that want to use a frontend framework.
  • 0
    @reflexgravity you say frontend framework, in the means of react/ng.

    I feel you. Totally. I have complicated workflow on my end too. And we had to tons of refactoring to achieve what we have right now.
  • 1
    @mt3o Yeah. We are now rendering the UI from server-side which is slower and it's making the clients annoying. So to improve this we have decided to take this step. Anyways I have decided to use AJAX (over the proxy server approach) to connect the APIs and use nginx to serve the frontend.
  • 0
    @reflexgravity can you make some load tests before and after rewriting everything and share the results? I'm curious of your performance gain.
  • 1
    @mt3o yeah. Sure. But the project will take upto 3 months to complete.
  • 0
    @reflexgravity replace Java w/ Kotlin ;-)
  • 0
    @mt3o +1 for Insomnia
  • 0
    @oh-4-fucks-sake Backend will never change.
  • 0
    @oh-4-fucks-sake any real benefits other than pleasuring the dev, if he knows kotlin?
Add Comment