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.
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?
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.
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.
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.
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.
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?
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?