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

Free Support Forum - aspose.com

Convert To PDF after mailmerge performance issue

Hi,
We meed a performance when using aspose to convert a merged doc to PDF. It seems using huge memory for the converting a PDF which contains about 150 pages.

I attach the jconsole statistic in the attachment. We are generating pdf in a single thread. You can see in the graph memory usage grow for about 1 GB in 8 seconds at 11:46.

This is how we convert the doc:

protected void convertToPdf(Document doc, File outFile) {
OutputStream tempOut = null;
try {
tempOut = new FileOutputStream(outFile);
doc.save(tempOut, SaveFormat.PDF);
} catch (Exception e) {


}

Could you pls give some hint on why it cost so much memory and give some advice how we can imporve the performance? Thank you!

Hi Kin,
Can you please also share your input Word document you are converting to PDF for further analysis? Please also share Which operating system and Java version are you using?
Best Regards,

Hi Muhammad,

We are using java 1.6 and the performace test is run in my local mac OS 10.10.4. Attached the doc.

Hi Kin,
Sorry, I was not able to reproduce this issue at my end using the latest version of Aspose.Words (i.e. 15.6.0). Can you please confirm if you are using the latest version and you have attached the correct document? As I can see, attached document has 40 pages.
Best Regards,

Hi Muhammad,

We are using Aspose Word for Java 14.8.You can add some item in the table to make a larger doc. And I think you will find it memory costing, pls correct me if it just cost a little mem in your machine.

In fact, during my test we found Aspose convert usually cost large memory when dealing with large PDF conversion. It’s critical for us because we have huge volume PDFs to convert and the convert usually run on multiple server in a concurrent environment. We need to tune the performance.

Regards
Kin Lin

Hi Kin,
We always recommend using the latest version as latest versions hold more features and fixes. If we consider performance issue in 14.8, it will not be fixed in 14.8. The issue will be fixed in later versions and you will have to upgrade to later versions after the fix.
Please test your documents with 15.6.0 (which is the latest one at the moment) and let us know if you still see any issue.
Best Regards,

We can’t do that. The upgrade has compatibility issue and we have thousands of templates of our customer. Last time we do the upgrade we take half year to solve all these issues.

Please let me know why it cost so much memory and once again can you pls share your test result?

Hi Kin,
Sorry, I do not see and difference in memory usage using 14.8.0 and it is same as 15.7.0. I can notice a 250 MB increase in memory usage during conversion of attached 40 pages document. If I copy the table again and again to generate a 160 page document, then I can see 500 MB increase in memory usage for 160 pages document.
Can you please test in a standalone console application and share if you see the same results at your end? I tested on a Core I7 4th Generation machine with 8 GB RAM.
Please also share your complete code if the problem persists.
Best Regards,

Hi Muhammad,

Thank you for your test. I use my laptop and have a similar test. while the Aspose “save” method allocate about 180M memory for a 64 pages PDF.

It’s still too large for us because sometimes we have tens of PDF generating concurrently, then the JVM will keep using most of the time GC.

Do you have any suggestion for the performance tuning?

Env: MacOS 10.10 2.2GHz i7, with 16GB RAM.

Hi Kin,
Normally a document takes ten times memory of its original size but in some cases (like your documents have very large tables) memory consumption can increase significantly.
This issue has been logged into our issue tracking system as WORDSJAVA-1127. We will keep you updated on this issue in this thread.
Best Regards,

Hi Muhammad,

Have you team fixed the issue for the WORDSJAVA-1127? The traffic in our system is growing and performace issue is blocking us.

Besides conversion, we profile the merge process and found a lot of small objects and it also consume a lot of memory, can you look at it too?

Regards,

Hi Kin,
As far as WORDSJAVA-1127 is concerned, it will be improved gradually with the new releases however a request to share the ETA for this issue has been forwarded to our product team. We will keep you updated on this.
Regarding small objects issue, can you please share more details (possibly code and screenshots to highlight the issue)? Do these objects reside in memory even after the garbage collection?
Best Regards,

Hi Muhammad,

Thank you for your reply. But do you know the schedule when the product team will fix it?

The small objects will be garbaged after the merge. But it seems if I use the ReflectionDateSource, Aspose need all the data during the merge. I think if I use XML as data source Aspose will use memory as stream. Can you confirm with that and do you have a estimation on how the memory is consume, is there some peak if I move to XML?

Regards,

Hi Kin,
If we use 32-bit version of the JDK, we see a big difference in memory usage. You can use this workaround (until the issue is fixed) if it is feasible for you. It will work with 14.8.0 as well as 15.8.0.
We are also fixing this issue for 64-bit versions and fix will be available in the coming release (i.e. 15.9.0). You will have to upgrade your version to 15.9.0 once it is released because this fix will not work in 14.8.0 in any case.
Best Regards,

Hi Muhammad,

Thank you for the information. That’s a good news it will be fixed in the new release because we can’t use 32-bit JVM. That’s much more bigger change than upgrading Aspose.

Do you know when 15.9 is going to release?

Regards

muhammad.ijaz:
Hi Kin,
If we use 32-bit version of the JDK, we see a big difference in memory usage. You can use this workaround (until the issue is fixed) if it is feasible for you. It will work with 14.8.0 as well as 15.8.0.
We are also fixing this issue for 64-bit versions and fix will be available in the coming release (i.e. 15.9.0). You will have to upgrade your version to 15.9.0 once it is released because this fix will not work in 14.8.0 in any case.
Best Regards,

Hi Kin,
Normally we release new versions at the start of every month so you can expect 15.9.0 to be released in the first week or start of second week of next month.
Best Regards,

The issues you have found earlier (filed as WORDSJAVA-1127) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,

We meet the following issue after upgraded to 15.9. The same code is running correctly before the upgrade.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at com.aspose.words.zz39.zzj(Unknown Source)
at com.aspose.words.zz39.zzt(Unknown Source)
at com.aspose.words.zz23.zzr(Unknown Source)
at com.aspose.words.zz23.zzs(Unknown Source)
at com.aspose.words.zzZM8.zzZ(Unknown Source)
at com.aspose.words.zzZM8.zzZvw(Unknown Source)
at com.aspose.words.zzZM8.zzZ(Unknown Source)
at com.aspose.words.MailMerge.zzY(Unknown Source)
at com.aspose.words.MailMerge.executeWithRegions(Unknown Source)

Regards

Besides, we found another serious issue when user use some calculated field in the template.

The merge process will keep asking for memery until my 4GB jvm become OOM. And the merge process will never complete. Attached the template.

I’m not expecting so many performance issue for the lib.

Regards

Hi Kin,
Sorry, we were not able to see any exception on converting your attached document to PDF. We were not able to test mail merge part as we do not have your complete code and data source. As far as performance is concerned, I can see drastic reduction in memory usage while converting your document (40 pages) and a larger version of your document (160 pages) to PDF.
Please share your complete code with data source to reproduce the issue at our end. We are sorry for the inconvenience.
Best Regards,