eggplantSword's avatar

How to handle very large requests on slow or irregular internet

Hey, currently we're having a problem with our system where there are some big json requests that are taking too long and causing timeout errors. Right now there is a json with 56k+ lines in it, our app isn't able to send the request even with over 30mb internet speeds.

The request is coming from an app towards a Laravel project. There are no images or files in the request it's literally just text.

What should we do here? How should we deal with these sizes of requests?

0 likes
5 replies
tykus's avatar
  • Make the Response payload smaller; trim the fat...
  • Pagination
  • Make discrete endpoints for data that can be linked rather than returned
eggplantSword's avatar

@tykus The request being sent is a survey report, there isn't anything to remove super easy.

For pagination im not sure how that could work since the request is coming into Laravel not out, i assumed pagination was more for stuff like tables, this is a singular report.

Could you give me an example of this? Maybe it's similar to something we're doing with the images. They upload to a separate endpoint and the endpoint returns a path that is used in the survey report, you mean adding more endpoints like that?

tykus's avatar

@msslgomez I misunderstood, so your application is injesting this data?

Are you trying to process the data immediately, or are you delegating it to a background Job? It should not be a problem to receive a Request with a large JSON payload / file; but, what you are doing with that data in the context of that same Request might well be your issue!

eggplantSword's avatar

@Merklin I think you misunderstood, the large request is not coming OUT of Laravel, it's going TO the Laravel project. or maybe I misunderstood the links, they're all from Laravel's side.

Please or to participate in this conversation.