When tried to load test, a Docx4j based PDF conversion application, we observed that the application doesn't scale beyond 15 concurrent users. The scenario is that 20 concurrent requests to render a PDF from a Docx template by binding it to an XML bring down the application server with Max Heap Size set as 1024M. We are using FO-XSL for PDF conversion. The core part of the code would be looking like below :
- Code: Select all
wordMlStream = new FileInputStream(input_DOCX);
WordprocessingMLPackage wordMLPackage = Docx4J.load(wordMlStream);
// Open the xml stream
xmlStream = new FileInputStream(new File(input_XML));
Docx4J.bind(wordMLPackage, xmlStream, Docx4J.FLAG_NONE);
FOSettings foSettings = Docx4J.createFOSettings();
os = new java.io.FileOutputStream(OUTPUT_PDF_PATH);
Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
Is there any possibility of optimization here?
Thanks in advance for suggestions....