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

Free Support Forum - aspose.com

Slowness when converting from pdf to jpg with multiple threads

I've been evaluating aspose.pdf(JAVA) for pdf to image conversion. I find that if I try to convert with 10 concurrent threads, the conversion takes 2-3 times the time it takes with just one thread. I have this running on an EC2 instance with high memory and CPU and don't see any spike in the memory or CPU utilization.


Here's what I'm trying to do:


I have a REST api that does the conversion. The main method has this code:


Document pdfDocument = new Document(inputStream);

PageCollection pages = pdfDocument.getPages();

JpegDevice jpegDevice = new JpegDevice(new Resolution(75), 30);

// Loop through all the pages of PDF file to convert to image

pages.forEach(p -> {

StopWatch stopWatch = new StopWatch();

stopWatch.start();

ByteArrayOutputStream imageStream = new ByteArrayOutputStream();

// Convert a particular page and save the image to stream

jpegDevice.process(page, imageStream);

stopWatch.stop();

LOGGER.info(requestId + ": Aspose pdf page processing time: " + stopWatch.getTotalTimeMillis());

});



When I run a JMeter test with 10 concurrent users, I see that each call is 2-3 times slower than with just 1 user.


Do you have any known issue with multiple threads?


Thanks,

Anu

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px} span.s1 {text-decoration: underline} span.Apple-tab-span {white-space:pre} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #7e504f} span.s2 {color: #931a68}

Hi Anu,


Thanks for your inquriy. We are looking into the issue and will update you accordingly. However, we will appreciate it if you meanwhile share your sample PDF document as well, it will help us to investigate your issue exactly.

We are sorry for the inconvenience.

Best Regards,

Here is the sample file.

Hi Anu,


Thanks for sharing the sample document. I have tested the scenario with shared PDF document and noticed that conversion time for one thread is less than multiple threads. So I have logged a ticket PDFJAVA-36464 in our issue tracking system for further investigation and rectification. We will notify you as soon as issue is resolved.

We are sorry for the inconvenience.

Best Regards,

Hello tilal
I have the same issue when convert pdf to JPEG by using version 20.8。is this ticket solved?

@wqc8994

The ticket associated with this forum thread was resolved for the reported PDF. However, could you please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly. Please also share the code snippet which you are using for conversion.