We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Memory/Processing issues using version 17.5

We have updated to the latest version and are STILL experiencing unacceptable processing time and resource usage. Our expectation is that the ASPOSE API should perform as well as or better than our current solution PD4ML.

We can process the supplied html stream using PD4ML in sub-second processing. Processing the EXACT SAME html in ASPOSE PDF-Java take EXPONENTIALLY longer (10-50 times longer) and we are UNABLE to process files much larger that the file supplied.

During our analysis the PDF document creation process spikes CPU usage on ALL CPU’s to 100 percent. Memory is utilized and NEVER released even though we have called MemoryCleaner.clear().

We have tried the code using BOTH a file input stream and byte input stream and the results are the same

I’m attaching all source code and resulting files.

So is the the BEST performance we can expect out of the ASPOSE PDF API?

*****************Start Source Code

System.out.println(“START”);
System.out.println(“Read HTML File”);
java.io.File file = new java.io.File(“C:\temp\democo2015base.htm”);
System.out.println(“Create File Stream”);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
//System.out.println(file.exists() + “!!”);
//InputStream in = resource.openStream();
System.out.println(“Create Byte Array Outputstream”);
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
byte[] buf = new byte[1024];
try {
for (int readNum; (readNum = fis.read(buf)) != -1;) {
bos.write(buf, 0, readNum); //no doubt here is 0
//Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
System.out.println(“read " + readNum + " bytes,”);
}
} catch (java.io.IOException ex) {
}
System.out.println(“Create Byte Array”);
byte[] bytes = bos.toByteArray();
//instantiate Document Object with ByteArrayInputStream while passing byte array as argument
System.out.println(“Create PDF”);
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(new java.io.ByteArrayInputStream(bytes), new com.aspose.pdf.HtmlLoadOptions());
//get the page count of PDF file
System.out.println(“Output Number of Pages”);
System.out.println(doc.getPages().size());
System.out.println(“Save PDF”);
doc.save(“C:\temp\aspose_html_content.pdf”);
System.out.println(“END”);
MemoryCleaner.clear();
}

*****************End Source Code

Hello Paul,


Thanks for contacting support.

paul.calhoun:
During our analysis the PDF document creation process spikes CPU usage on ALL CPU’s to 100 percent. Memory is utilized and NEVER released even though we have called MemoryCleaner.clear().

I have tested the scenario in an environment (i.e Windows 10 EN x64, Eclipse Neon 4.6.2, JDK 1.8, Aspose.Pdf for Java 17.5) and was unable to notice the issue. The CPU usage was maximum upto 83% for 1 second and all memory was released after the code execution completed. For your reference, I have also attached an output generated over our end.

We will really appreciate if you please share you environment details, so that we can test the scenario in specific environment and address it accordingly.


Best Regards,

We are running on Windows 2K8 x64 servers with four core cpu’s and 64 gig of ram. The code is executing in a Java 1.6 runtime on a J2EE server (IBM Domino).


I’m curious how much local ram you have and how much ram you have allocated to your HEAP.

The systems we are running on have plenty of resources, so other than than the run time I’m not sure what the issue can be.


Hi Paul,


Thanks for sharing environment details.

I have 8GB of RAM installed in the system where I have tested the scenario and I have not allocated any memory to HEAP manually, as its working with default settings. Furthermore, different JDK versions take different amount of physical memory which also effects the performance of your program. Please try using latest JDK version and share if you get better results.

Would you also please confirm that if you are working with WAS (WebSphere Application Server), provided by IBM? This way we can also test the scenario in specified environment.

Best Regards,

We are running on IBM DOMINO (we are calling the code from an XPage (web page) to execute the Java code on the back end.


We are not currently able to update the JDK from 1.6.to 1.8 so this is the environment we have to run in for now.

With that said, given the resources on the server (lots of RAM and many CPU’s) it does not really make much sense that the performance difference would be this different.

As you probably can not test on an IBM Domino Server I would be curious about testing on the IBM WAS platform as results should be comparable.

Thanks.

Hello Paul,


Thanks for writing back.

I have tried to test the scenario with IBM WAS Application but API threw an exception at document loading. Hence I have logged an issue as PDFJAVA-36821 in our issue tracking system for the sake of detailed investigation. We will further look into the details and keep you updated with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,

@paul.calhoun,

Thanks for your patience.

We are pleased to share that the issue PDFJAVA-36821 reported earlier is resolved in latest release of Aspose.Pdf for Java 17.9.

Please try using the latest release version and in case you face any issue, please feel free to contact.