I've my front end written using HTML/CSS/Javascript. Front end is communicating with the backend(Oracle database) using Java Webservices (Spring boot app).

Situation #1: User clicks on the Download button, using Ajax call, I call my Java webservice, java webservice returns the data in JSON format, I display this data in the UI in tabular format.

Situation #2: Since the amount of data to be returned is going to be huge, when a user clicks on the download button,I am expecting that the query could take hours or maybe a day to finish. Once the query is finished,I would like to upload the data returned from the webservice in a file at some location on the (RHEL)server so that when user comes back, he/she can click the Download button and download the file with huge data in whatever format it was saved (CSV, Excel etc)


1) I was reading in another Stack overflow post here that saving file using FileSystemAPI on Firefox isn't supported. I am wondering if this is even a good solution based on the situation #2 described above?

2)If a webservice keeps on running for a day, isn't it going to time out in few hours? I've a feeling that the approach I've mentioned in Situation #2 above isn't an efficient one.

3) Is there something else that can be done in a more efficient manner to accomplish my task? Probably, some scheduling at database point of view?

4) In Situation #2, since the query is going to take long time, I am also planning to change the display of Download button to something "Come Back again". In this scenario, how would I determine that a particular query is going to take long time?

1 Answer 1


In situation 1 if your displaying the data on the page I wouldn't use download unless a file is getting downloaded from the users perspective.

In situation 2 your button should be wired to a web service that schedules a job. This is so you don't end up DDOSing yourself with legitimate traffic. This also gives you a feedback loop to tell your users to check later, and doesn't leave a request essentially hanging. The job should put the results somewhere in a convenient format, and you could even email/notify users when the data is ready. You would need some extra UI pieces to display job statuses/download results. The solution in your question 1 seems like overkill based on your scenario.

It is up to you as a developer/team to know what requests are going to be slow and plan accordingly. Limiting results and minimum requirements are ways to achieve this (eg returning only 500 results or requiring first and last name). If a user wants results that you know are slow force them through a different workflow.

  • Thanks @Ryathal. 1) When you say your button should be wired to a web service that schedules a job, which job you are referring to here? Some database job like cron job or anything else? 2)And is this job must be configured to send an email via SMTP something?3)Do you think, Java Messaging Service could be used here?
    – John
    Jan 14, 2019 at 22:14
  • @John the type of job is somewhat arbitrary, the main goal is that you are queuing these requests so there aren't so many running concurrently that your performance is degraded for all users. 2 is a user friendliness suggestion, you know when these searches complete and you can determine the best way of telling them, telling them to come back later isn't very helpful to the user as their search may not be processed.
    – Ryathal
    Jan 15, 2019 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.