Set license very slow

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> We are using latest version of Aspose.Cells.

The following code in BOLD takes long time to execute when run from our servers.


using (Stream licenseStream = GetType().Assembly.GetManifestResourceStream ("MyNameSpace.Reports.AsposeLicense.Aspose.Total.lic"))
{
if (licenseStream == null)
{
throw new Exception("Can not find licence file in '" + _templateLocation + "' location.");
}
_license = new License();
_license.SetLicense(licenseStream);

}

We did not face this issue in the earlier version. Is this a known problem? Is the way to setLicense changed in new version?? Please let us know asap.

Thank you

Dear ndor,

Set license code has not been changed. What was your older version that was working fine? And what is your current version?

Old version of Aspose.Cells.dll was 4.8.2.15 and new version is 5.2.0.0.

Another issue we found is that any public method that returns WorkbookDesigner would take a long time (longer than 30 seconds) during instantiation of the object containing the method. It’s likely that it would also be caused by public methods that have WorkbookDesigner among its parameters. Apparently, it doesn’t cause problems if the method is private. Please investigate.

Thanks

This seems to happen on some machines. On further investigation it seems that its taking before the method (code accessing Aspose classes like License, WorkbookDesigner). This could mean that JIT Compilation is taking long. Is this a known issue? Why would this take long for certain machines?

Hi there,

Regarding your request on live support, I am not sure if you recieved the replies so I will post them here as well.

Are you using a relative path to the license file e.g license.SetLicense("Aspose.Cells.lic"); If so try using the full path as other directories may be scanned while looking for the license file and if one is say a network drive this could be the reason for the slow down.

Also ensure you are running your project in Release mode and not in Debug mode. I would also advise to run it straight from the EXE and not from inside Visual Studio and see if it runs properly then. This is because Visual Studio can often slow things down with debugging information.

Thanks,

Hi Adam,

Thanks for sharing this very useful information…

We are embedding the licence, there is no relative path involved. FYI, this works fine on some machines. This is related to JIT compilation. Following is the machine spec which might be helpful to you guys in figuring out the issue.

Windows Server 2003 R2, Standard x64 Edition, Service Pack 2. Pentium Xeon L5520 2.27 Ghz, 24 GB RAM with 16 processors.

Please let us know asap.

Thanks

Hi,

Thanks for reporting. We will look into it. Meanwhile, can you please use relative path and let us know your findings. Also, what are your requirements that you choose Embedding the License than using relative path.

Hi there,

Thanks for this additional information.

Is this slow down happening only the first time the application is run? or after every time the appication is executed?

We have never seen any issue like this before, as suggested by Shakeel, please try using different methods of setting license. Try loading the license from file and from stream etc.

Thanks,

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,

Please attach the test project and related files. We have not found such slow issue in Visual Studio or IIS environment.

Thank you

Hi,

Moreover, please don’t attach your license file with project here in the forum, you should only email your sample project to us.
To email (with your attachment(s) and license file), please follow the below mentioned steps:

1: click the Contact button in the Post

2: In the drop down list options click "Send Amjad Sahi an Email”.

3: Attach the project and send it (you may zip the files prior attaching it).

4: Once you have done it, kindly confirm us here in this thread.


Thank you.

As I said earlier that this happens only one time (JIT compilation!) when Aspose class methods are called. This was not happening in older version of dll. The code that access aspose is still same, we just replaced the old dll with new dll and started seeing this problem. The issue of using or not using relative path is ruled out since we are embedding the license.

FYI, The new dll works on some machines.

Can you try to replicate the issue using a machine with similar configuration that I had stated in my earlier post?.

Hi,

As we told you earlier we could not find your mentioned issue testing it on different machines, we tested on many machines. It would be great if you could create a sample test project, zip it and post it here with your machine and other issue details/information, so that we can look into it soon.

By the way did you try our latest version v5.2.2.

Thank you.

Hi,

It took less than one second in our test environment which is given below.

Windows Server 2003 x64 Enterprise SP2

.NET Framework 2, .NET Framework 4

Windows 7 Ultimate x86
.NET Framework 2, .NET Framework 4

Apologies for the confusion between our initial suspicion and subsequent discoveries. To reiterate:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

  1. the license file itself is not causing the problem. Wherever we put the license file, the behavior is the same on all locations (local desktops or servers)
  2. if Aspose certain classes (e.g. License or WorkbookDesigner) are used in or returned from any public method of a class, that class takes more than 35 seconds to be COMPILED on certain servers (specs mentioned) for the first time (JIT). This doesn’t happen on subsequent references to these classes
  3. the same classes (containing these Aspose classes) do not take that long to COMPILE on our local desktops
  4. the actual execution of these methods take a second or so on all locations (desktops or servers)

To illustrate, we shall simplify our code here. We have the following classes:

public class ValidationManager

{

//…

public void Validate(…)

{

// Do some stuff here

// log timestamp #1

// now create instance of the following class:

ValidationReportGenerator _repGen = new ValidationReportGenerator(…);

// log timestamp #5

// now call the method:

_repGen.GenerateReport(…);

// log timestamp #6

}

}

The other class (used above) is:

public class ValidationReportGenerator

{

public ValidationReportGenerator()

{

// log timestamp #2 – this is the very first line executed by this instance before anything else is done

// Do stuff

}

public void GenerateReport(…)

{

// Do stuff

// log timestamp #3

WorkbookDesigner designer = new WorkbookDesigner();

// Do more stuff

//… this is a long method

// log timestamp #4

return designer;

}

}

In the above scenario, in accordance to the points mentioned:

  1. the difference between timestamp #1 and #2 = 35 seconds the very first time this part of the code is called. This is even before the method that uses WorkbookDesigner is even called. This (we suspect) is due to the JIT compilation of ValidationReportGenerator
  1. difference between timestamp #3 and #4 ~ 1 second

The above indicates that the JIT compilation takes 35 seconds whereas the execution takes 1 sec. Obviously, once the class has been compiled at runtime, that delay doesn’t occur during subsequent calls.

This kind of code is being executed in our Windows Services, which have a startup timeout of 30 seconds, and hence they fail to startup (due to the 35 JIT compilation delay). I hope this makes things clearer than before. Please advise.

Hi,

1) Could you create a web project without Aspose.Cells to check whether it’s the issue of Aspose.Cells?

2) Could you change the timeout of Windows Services now?

3) Please share us some info of server:

Net frame version? IIS version?

Hi,

Please see the reply at this post: 288062