Java exported Excel to browser timed out

timeout passed to the browser due to slow query speed or large amount of data

because the default connection timeout for HTTP requests is 30 seconds, do you have any good methods?

POI used by the development package


Yes, I have also encountered this problem, but the timeout, as i38me said, will not be timed out. I guess your application front end is also configured with a reverse service proxy. For example, the nginx,nginx we use here can configure the connection timeout


but it is true that sometimes many exports will be very slow, and optimizing the export performance is of course what you need to do, but it is also feasible to modify the return scheme without Synchronize. For example, we only use asynchronous export mode here, and the export request comes over. As long as there is no problem with the verification, it directly returns the success, starts the thread asynchronously to export, and sends the final result to that person by e-mail


of course, due to the long export time, large amount of data and complex business processing, it may take up a high amount of system resources, resulting in a slow response of the system to other applications. It is recommended that the export function should be deployed separately (not on the same application as other business functions), preferably a separate read-only library, not directly connected to the main database, otherwise, if the query logic is complex, It is possible to bring down the main database (we have encountered it before. Die of pain. One export function is executed, and other applications are extremely slow to respond. Face covering.), is fine if it just drags down the read-only library, and it will not affect the function of normal applications


above are my suggestions, for reference only

http request has a connection timeout, but it is only a connection timeout when establishing a connection. If your network is normal, the server will not have a connection timeout. Exporting excel is slow, which will only lead to slow response. For example, if you download a large file for an hour, the browser will not report a connection timeout.