How to improve document viewer and comparison APIs performance in Java


Hi,

Our project is based on document viewing and comparison of documents. While sampling for 50, 100 and 500 pages found that viewer api consumes lot of time for converting to html(+css+svg) pages. Can you please help us to improve the performance of these apis?

for viewer - we are using the api calls as mentioned below:
HtmlOptions options = new HtmlOptions();
options.setResourcesEmbedded(true);
options.setPageNumber(pageNumber);
pages = document.viewerHtmlHandler.getPages(fileName, options);

Please find the comparison and viewer api performance metrics for sampled pages (50, 100 and 500 pages) as following:

Applied configuration with 4 GB max memory

Comparison API

Pages

Time Taken (in Secs)

50

13.65522331

100

21.77279405

500

70.60722131

Viewer API

Pages

Time Taken (in Secs)

50

101.851406

100

184.5524935

500

787.8239795



Thanks,
Prem Kumar




Hi Prem,


Thanks for sharing your concerns.
Can you please tell which versions of the APIs you are integrating/evaluating ?

Kind regards

Hi Atir,

Thanks for your reply. I represent NCS, Singapore and we purchased group-docs total package.

Please go through the api versions are below:
groupdocs-viewer - 3.7.0
groupdocs-comparison - 16.11.0

Thanks,
Prem Kumar

Hi Prem,


Thanks for sharing the details. Please note that APIs performance varies from document to document based on the content. Documents can be different from each other based on their content like tables/images etc.
Can you please enable cache to true and share performance details?

Many Thanks

Hi Atir,


Thanks for your reply.

We have enabled the cache before taking the sampling.

The performance metrics (50, 100 and 500 pages) which we shared earlier are along with cache, please go through the method as below:

public Document(String fileName, String userName, int pageNumber) {
this.filename = fileName;
this.userName = userName;
this.pageNumber = pageNumber;

License license = new License();
if(Files.isReadable(FileSystems.getDefault().getPath(Utils.getProjectProperty(“license.path”)))) {
license.setLicense(Utils.getProjectProperty(“license.path”));
if (!License.isValidLicense()) {
throw new RuntimeException(“License is not valid”);
}
}

String filePath = Utils.getProjectProperty(“storage.path”) + File.separator + userName;
createDirectory(userName, filePath);

ViewerConfig config = new ViewerConfig();
config.setUseCache(true);
config.setStoragePath(filePath);

this.viewerHtmlHandler = new ViewerHtmlHandler(config);

}

Please suggest.

Regards,
Prem Kumar

Hi Atir,


We measured based on single test user (above metrics) with 4 GB max memory. What happens to groupdocs APIs when multiple users trying to access the API, this will slow down api calls further? how to optimize this?

Please suggest.

Thanks,
Prem Kumar


Hi Prem,


We are investigating your scenario and we’ll update you about the outcome shortly.

Kind regards

Hi Prem,


We investigated performance of GroupDocs.Viewer for Java at our end. We tried to render a 49 paged PDF document into HTML and it took almost 100+ seconds. However, we rendered same document again with cache enabled and it took 4 seconds.
We’ve logged your scenario (viewer performance improvement) in our internal issue tracking system. As we get any update on it, we’ll surely apprise you.

We’ll appreciate your patience.
Kind regards

Hi Prem,


In order to investigate performance issue in GroupDocs.Comparison for Java 16.11.0, we need the problematic files. Can you please share problematic files ?
We’ll appreciate your cooperation.

Kind regards

Hi Atir,


Thanks for your reply.

Please find the problematic files for comparison api from attachment.

Regards,
Prem Kumar

Hi Prem,


Thanks for sharing the problematic files.
We’ve reproduced same performance issue at our end as well. Hence, we’ve logged it in our internal issue tracking system with ID:COMPARISONJAVA-169. As we get any update from the concerned team, we’ll surely notify you.

Kind regards

Thanks Atir

Regards,
Prem Kumar

Hi Prem,


You’re welcome.

Best wishes

Hi Atir,


By any chance, do you have an idea when the next release of viewer API will be released?

Regards,
Prem Kumar

Hi Atir,


Is there any update from your concerned team on the api performance issue? Please update us the status or progress of this issue. Thanks.

Regards,
Prem Kumar

Hi Prem,


You’re welcome.
The next release will be available within few weeks. As it gets on-board, we’ll notify you.

Kind regards

Hi Prem,


We got an update from the concerned team regarding GroupDocs.Viewer for Java 3.x performance issue. Performance of PDF documents rendering will be improved in upcoming version of the API. As release gets on-board, we’ll apprise you. Furthermore, please consider document rendering in multiple threads. For example, you have a document with 100 pages, these 100 pages can be divided into two chunks 1-50 and 51-100 pages and rendered in two threads. In this way all pages will be rendered much faster but please keep in mind that resources (CPU, RAM) consumption will be increased.
However, as we get any update on GroupDocs.Comparison for Java 16.11.0 performance issue, we will notify you.

Have a nice weekend ahead.
Kind regards

Hi Atir,


Thanks for your response.

Can you please share with me your (groupdocs) standard performance metrics for groupdocs viewer, comparison and annotation apis?

Regards,
Prem Kumar

Thanks Atir


Regards,
Prem Kumar

Hi Prem,


Document rendering, comparison or annotation depends upon multiple factors and performance varies for different documents (different documents with same page numbers) in different environments. For instance, let’s discuss document comparison API for Java, the sample document (source50p.pdf) you shared earlier took 13.65 seconds at your end. It took 20+ seconds at our end, that is maybe due to difference of memory utilization (RAM allocation to different processes).
Let’s take another example, if we have two different 50 paged documents, it is quite possible that rendering or comparison of these documents take different time spans (performance varies here). This is because of difference in their content (images/tables/clip arts etc).
Hence, we cannot share any accurate/absolute performance metrics with you. However, document rendering performance will be improved (of course it will be improved from current performance status) in upcoming release of the API. We’ll let you know if we get any update regarding GroupDocs.Comparison for Java 16.11.0.

Kind regards