I work on a java web-application. In this application, users can generate some reporting (xls/pdf) and create some pack of multiple reporting. (using pdfbox, itext)

More and more data are added in the application since few year.

The generation of reporting is made on the same server as the application, which doing slow-down or worth, GC overhead when multiple user do at the same time some reporting or if they are too much data to convert, so the application is down...

What is the best way to generate pdf on a web application ?

Export all the generation on an other server ?


You have a couple of choices, depending on how much time and money you have.

  1. The cheapest solution is for your users to talk to each other and schedule when they will request the big reports so there is never more than one running at a time.
    I consider this choice unsatisfactory, but it is cheap.
  2. Have your networking/server people set up a second web server and put the two of them behind a load balancer.
    This will cost more in terms of hardware, but that's often cheaper than rewriting your application.
  3. Change your application so that when a user requests a report, the request is put into a queue to be processed later.
    The queue could be processed on another server (or not) as desired. You will have to figure out how to give the user a 'receipt' for their request and how to get the file to the user minutes/hours later (please don't email the file).

    This may mean having the user log onto a special web page that shows recently created reports
  4. Do a combination of #2 and #3. Do #2 right away so the users will be happy then start doing #3 (which could take months). In the long run, this is probably your best choice because you'll even out the load on your servers, you'll have redundancy of hardware, and you'll have an example of how to balance load across machines that you might use on other projects.
  • 1- Impossible to many user over the world ^^. 2- We already have a loadbalancer. 3- Some time user won't wait, they load the file to got a preview to inspect if any error are present, before the file was send to a supplier. Can we call the current application, which was redirect to an other server with the date to export, to generate the file and redirect the file to the user, easily ? Like use an api ? – Alexandre Jan 15 '18 at 16:49
  • @Alexandre You're referring to #1? I agree, it's ridiculous. However, if you only have 10 users in the world, it's a lot cheaper than any other solution. – Dan Pichelman Jan 15 '18 at 16:51
  • sorry, i failed when i answer, i edited it – Alexandre Jan 15 '18 at 16:54
  • Did your company write the java web application? I do not understand your point #3 - either the user has the report or they don't. What do suppliers have to do with this? – Dan Pichelman Jan 15 '18 at 17:00
  • yes, some developpers write it. – Alexandre Jan 16 '18 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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