title: Jasper Reports taking long time in Server, But not in local
body: <p>I am trying to generate PDF files by DynamicReports which uses JasperReports in background. I tried generating 50 pdf files in my local machine. It worked fine, it took around 35 seconds to generate and upload the file to my aws S3 client.</p>
  
  <p>After uploading the JAR to server, server takes 50 seconds for each PDF file to generate. So totally it take 2500 seconds for 50 files to get generated and uploaded in s3. Each file is around 3 or 4 kb</p>
  
  <p><strong>Updated: 
  I tried to debug more in server. As far as I found, toPdf function takes a lot of time. Not sure this is because of toPdf or Storing the filestream in server</strong></p>
  
  <p>Code Snippet:</p>
  
  <pre><code>            try {
                String directory = "/home/ubuntu/generatedFiles";
                for(Invoice eachInvoice : invoiceList){
                    JasperReportBuilder report = design.build(eachInvoice);
                    String fileName = "invoice_"+eachInvoice.getId()+".pdf";
                    String filePath= directory+"/"+fileName;
                    FileOutputStream stream = new FileOutputStream(filePath);
                    report.toPdf(stream);
                    client.uploadDocument(filePath, fileName);
                }
                // Delete all the files in the generatedFiles folder
                File file = new File(directory);      
                String[] invoiceFiles;    
                    if(file.isDirectory()){
                      // Delete the files from machine
                    }
                } 
             catch (DRException e) {
                       e.printStackTrace();
             }
  </code></pre>
  
  <p>If anyone can help me through this!! It would be awesome!!</p>