Home > Back-end >  Front end sends a request, or background circulation sends the request better??
Front end sends a request, or background circulation sends the request better??

Time:10-20

Now send a request to the listening state, ten times is ten times with js cycle is sent to a Java background, background and HTTP requests, or js sends a request to a Java background, background loop hair ten times htto request? From the number of threads and efficiency into consideration, and refer to

CodePudding user response:

Help me by

CodePudding user response:

It also depends on your business needs
If each send a request, the front desk all want to know the status, it can only be at the front desk to send
If front desk just send a request, no matter what the background operation, only need to know the background last execution as a result, the background, he
Purely in terms of efficiency, in either case, you are to send ten times background, so if business needs to allow, try to avoid the front desk requests the number of times

CodePudding user response:

Why not just the front a HTTP request

CodePudding user response:

Front-end do... don't know what your business, why do you want to write a setinterval cycle request... front-end js

CodePudding user response:

Please say specific application scenarios,
analyzing the specific issuesYou must first meet the requirements, then consider performance
Can tell from the performance, batch natural batch, if the client server support http2.0 is doesn't matter

CodePudding user response:

No scene, there is no basis

CodePudding user response:

Must be backstage to do ah, don't you want to expose you to request routing out

CodePudding user response:

Look at their business, in the actual business;
The efficiency is normal, on the server will be better,

CodePudding user response:

Real-time access to other users to send to the background of news, I wrote a timer is on the front end, 30 seconds to send a request to the background, see if there are any new messages,
But always feel this way is not very good,
Your great god is how to deal with this kind of situation,

In addition, testing the validity of a user Session, if the invalid is prompted to logout, also need to continuously to the backend sends a request for the Session state?

CodePudding user response:

On the backend is reliable

CodePudding user response:

The back-end cycle is better

CodePudding user response:

Put the background, the front desk each request the background has a waiting TTFB time, if the circulation background, this time, performance is not appropriate, if in the background, is requests the background only once,

CodePudding user response:

Backend is good, front circulation sends a request, order not sure, connection is not stable, slow,
Front end is actually do show, do business to do in the back-end,
  • Related