The java pdf license in Google Append Engine (GAE Flex) is very slow

We are currently using Google Cloud, but we have the following problems:

First problem:

The Aspose-PDF-Java library was added to a GAE Standard (F4), however this type of GAE Standard machines only accept files smaller than 32MB and its solution is very heavy, so we wanted to see if there is another solution that fragments the jar library of aspose.pdf.

Second problem:

See moved the solution to GAE Flex, which allows larger files, however the license validation time is very long.

Actions done:

  1. Migrated from a GAE Standard to a GAE Flex
  2. The license load was placed in a ServletContextListener
  3. An SSCCE project was created to isolate the problem

Main problems detected:

  1. GAE Standard: does not accept the jar library, since it is very heavy above 32MB
  2. GAE Flex: the verification of the license is very slow, which prevents testing when the Docker is automatically 20 Pots.

Results:

Local machine:
0 mins, 0 secs.
License set successfully!

GAE Flex (Google cloud):
41 mins, 26 secs.
License set successfully!

Configuration:
Versión Aspose: 19.7

  app.yaml

runtime: java
env: flex

service:
licence-aspose-testtime

handlers:

  • url: /.*
    script: this field is required, but ignored

Code using:

public void loadApose() {
log.info(“Loading license…”);
try {

		java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS"); 
		String dateStart = "";
		String dateStop = "";
		java.util.Date d1 = null;
		java.util.Date d2 = null;

		dateStart = sdf.format(new java.util.Date());

		URL urlPdf = getClass().getClassLoader().getResource("Aspose.Pdf.lic");
		com.aspose.pdf.License licensePdf = new com.aspose.pdf.License();
		licensePdf.setLicense(urlPdf.getFile());
		
		dateStop = sdf.format(new java.util.Date());
		d1 = sdf.parse(dateStart);
		d2 = sdf.parse(dateStop);
		long diff = d2.getTime() - d1.getTime();
		long diffSeconds = diff / 1000 % 60;
		long diffMinutes = diff / (60 * 1000) % 60;
		System.out.println(diffMinutes + " mins, "+ diffSeconds + " secs.");

		if (com.aspose.pdf.Document.isLicensed())
		{
		    System.out.println("License set successfully!");
		} 

	} catch (Exception e) {
		log.error("Don´t exist license to Pdf.lic {}", e.getMessage());
	}

	log.info("Finish loading license...");

}

Is there any way to solve this problem?

@Jctovilla

We have logged an investigation ticket as PDFJAVA-38824 in our issue tracking system for further investigation. We will look into details of this scenario and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Project submission, only the license file is cleaned, it must be replaced by an active license (resources folder).

HelpAspose.zip (16.7 KB)

@Jctovilla

Thanks for sharing sample project.

We will surely look into this and will share updates with you as soon as we have some.

The issues you have found earlier (filed as PDFJAVA-38824) have been fixed in Aspose.PDF for Java 19.10.

Thank you for your response, we will do the tests.