Performance under load

I’m having a problem with the performance of Aspose.Excel in IIS with multiple simultaneous connections. I have created a simple harness to recreate the problem.

The harness starts a small number of threads, each of which uses aspose to read an excel file from and then write back to memory. The excel file opened is fairly complex 5 meg .xls file.

ie.



byte[] binary = workbook; # passed into the thread
using( MemoryStream stream = new MemoryStream(binary,0,binary.Length) )
{
excel.Open(stream);
}

using(MemoryStream stream = new MemoryStream() )
{
excel.Save(stream, FileFormatType.Excel2003);
}

If i run this on my single intel processor development box, i get the following results ( times are shown in seconds ):


1st Thread
2nd Thread
3rd Thread
4th Thread
1 thread
13 s



2 threads
26 s
26 s


3 threads
40 s
40 s
40 s

4 threads
55 s
55 s
55 s
55 s

ie, if i run just one thread, it takes 13 seconds to open and save back the workbook, 2 threads and they each take 26 seconds. But if i run it on a dual processor intel box, i get:


1st Thread
2nd Thread
3rd Thread
4th Thread
1 thread
16 s



2 threads
24 s
32 s


3 threads
30 s
41 s
48 s

4 threads
65 s
66 s
68 s
70 s

These results suggest very little performance gain is to be had by using aspose in a multiprocessor architecture.

If i use a 2 way opteron machine, the results are worse:


1st Thread
2nd Thread
3rd Thread
4th Thread
1 thread
9 s



2 threads
17 s
17 s


3 threads
27 s
29 s
29 s

4 threads
37 s
38 s
38 s
39 s

Note. the times taken are lower as it is a far faster machine.

Do you have any suggestions about how to improve the performance of aspose.excel when using it in such a fashion, or can you see how i may be testing this incorrectly.

I have a four way opteron around somewhere too. As soon as i find it, i can post results on that.

Thanks in advance for any help,

paul inglis
vidus ltd.

Hi Paul,

Could you please post your test project here? And what’s the memory size in your machines? And when running your program, could you please check Task Manager to see if CPU, memory or I/O is the bottle neck?

And could you please write a simple multi-thread winform application to see if the problem is caused by IIS?

The single processor machine is a 3 GHz pentium 4 with 1GB of ram and hyper threading turned on.

The dual processor intel box contains two 2.8 GHz xeon processors with ht turned on and 2 gig of memory.

Lastly, the dual processor amd box contains two opteron 248’s with 2 gig of ram.

My test application was a simple console app and was not using IIS. I just noticed the problem initially in IIS as i am using aspose.excel in part of a suite of web services.

Looking at the cpu performance on the two way amd box, the average cpu performance seems to hover around the 60% mark.

I can’t post the workbooks i’m using as is, but i should be able to create a dummy one which i’ll post later on but for reference the wookbooks contain a lot of formulae. I guess somewhere around 70% of the cells contain them.

paul inglis

Could you please post your whole test project here? I want to check your code to see what may cause this issue.

Since the CPU is only around 60%, I think that the bottle neck may be disk I/O. In my machine, it may consume 100% CPU if running a large program. Do you just save the memory or save it to disk?

I have posted my harness to your support email address. The sample excel workbook was created by hand with a couple of formulae in it to simulate my original workbook.

paul inglis
vidus ltd

Hi Paul,

Where did you send your email to? I don't get it. You can post at this forum. It can be only viewed by you and Aspose developers.

I clicked on the ‘contact us’ link under your name. I guess the information contained on that page is now out of date.

I’ve attached it here instead.

Paul Inglis
Vidus ltd.

Hi Paul,

It seems that all those threads are still running in one of your processor, not both of them. I don’t have a multi-processor machine on hand. Could you please check if both of your processors are busy when your program is running?

Which OS are you using? Could you please try another multi-threading program without Aspose.Excel to see if it works?

Other users have used Aspose.Excel in their multi-processor machine and find it works fine.

Here is a reference for working on a dual CPU machine.

https://forum.aspose.com/t/116247

If i run with a single thread, the first processor has about 90% load and the second around 20%. If i run with two threads, both processors report around 70% load. So it certainly appears that both processes are being used, even if the results suggest not.

And i’m testing on Windows Server 2003.


Paul Inglis
Vidus ltd.

Hi Paul,

Could you please do a test to help me figure out this issue? Currently I don’t have a multi-cpu machine on hand.

Please change your test program to:

1.In each of your working thread, start a stand alone program.
2. In this program, you can open and save file with Aspose.Excel.

Please check if perforamnce will improve in this way.

Thank you very much.

Ok, i’ve written a new harness to do this and have run it on my two way amd box. Here are my results.


1st process
2nd proces
3rd process
4th process
1 process
7 s



2 processes
9 s
10 s


3 processes
9 s
13 s
14 s

4 processes
18 s
18 s
19 s
19 s

Load also increases to 100% on both processors when more than 1 process runs.

paul

Hi Paul,

It seems that in multi-process mode the dual CPU works. While calling Save method, Aspose.Excel internally call some win32 APIs. In those Win32 APIs, they use global memory in a process. So your multi-thread program doesn’t work for a dual-CPU. In multi-process mode, this limitation is removed.

So is it possible to run your program in this way?

Thanks for the answer Laurence,

I’m not quite sure of the implications of doing this though. We are certainly going to have to rearchitect some of our code and as such this will need quite a bit of thought.

Is there any chance of a future release removing these win32 calls and hence the limitation?

Paul Inglis
Vidus ltd

We will investigate this possibility. But we should make sure of that first and the porting will take a relative long time.