multithreading - multithreaded web application in java -


I am doing a web application that is backed by Java as a front-end script. The concept requires me to process many files in the back. I will get the user from the date range (for example 1 July-8) and about 100 files for each day process. So in total I have 800 files.

I will get these details from JSP and appoint a background call on a shell script and return the results and display the user with the same.

Now I have done all this in the sequential approach - by which I mean without threads. So there is only one main thread that executes and the user has to wait up to 800 files, which are processed sequentially. Although this is really slow and because of this I am thinking of going for the thread. Since I am the beginning of threads, I read a few things about it and I have come up with the following ideas:

As I have read, the thread is to divide the work. I was thinking about 8 days of work to 4 threads, where each thread works 2 days


I would like to know whether I am following the right approach I am and my main concerns are:

  1. Is it recommended to lay eggs on multiple threads from a web application
  2. Is this a good way or not?

    Some guidance for moving forward with. An example example would be great thanks.

    Yes, you can run multi-threaded or long processing tasks in any high performance environment. You should also process the Servlet 3.0 asynchronous request to suspend the request thread and wait till long processing time to wait.

Comments