How to solve the problem of 504 caused by too long response time?

I am maintaining an older system. One of the requirements of struts2 + hibernate, is to find the data according to the request of the front end and then download the Excel file. If the request field is empty, then download all the data for today. Usually, there are no more than 3000 data in a day.

there is nothing wrong with the old system doing this. After I take over this project, I want to modify one place, that is, when I download, I have to download the two locations corresponding to each piece of data queried. These two location information is not in the database. One location needs to request a third-party interface, and one location requests another system of our company.

my method is also simple and rough, that is, after I find out, I go through it again, and each record requests location information twice. There is no problem with hundreds of pieces of data, but there is a 504 error when downloading more than 2000 pieces of data.

I can"t think of anything for the time being. I"m here to consult you. Thank you!

Sep.08,2021

emmm, can change the way of thinking. Refer to one of my previous answers to see if it suits you

.

https://codeshelper.com/q/10.

however, you can consider the way of changing space for time. If the location information corresponds to your data is unchanged, you can consider caching them in your database, doing a scheduled task, running in the middle of the night every day, caching the location information corresponding to the data you are going to download today to your local location, so that it may be much faster when downloading files at that time. And then using the asynchronous method mentioned in my question, sending it by e-mail, it should be able to completely solve your problem, and there will be no 504

.

can the location information be redundant into the corresponding data?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b362e1-343bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b362e1-343bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?