High CPU Usage

Hi,

I use Aspose Cells Java 7.7.0 to parse Excel files. It consumes a 30-40% of CPU and ~500MB of RAM for a 3MB file. It happens when executing the below code,

com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(stream);

This code creates a lot objects and occupies half of the java memory.

Is there any API to just read the first row? And proceed to the next with less CPU and memory.

Regards,
Jai

Hi Jai,

Thanks for your posting and using Aspose.Cells for Java.

Please download and use the latest version: Aspose.Cells
for Java v8.1.0.1
and see if it makes any difference.

You can load your workbook with Memory_Preference setting using the following code.

Java


LoadOptions options = new LoadOptions();

options.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);


Workbook workbook = new Workbook(“input.xlsx”, options);



Please also see the following documentation article that explains how to optimize memory usage for large files.


Please note, you will have to load the full workbook into memory to read first few lines of your worksheet.

If your problem still persists, then please provide us your Excel file. We will look into it and see if your issue could be fixed.



I have attached a sample file to main post.


I tried using MemorySetting.MEMORY_PREFERENCE, it has some effect on Memory usage but there is no improvement with CPU usage.

Hi,


Thanks for the template file.

I tested your scenario/ case using the following sample code with v8.1.0.1 and it works fine regarding CPU usage as well. It increases 6%-7% CPU usage only. I performed the test on my 64-bit machine (CPU: i7, OS: Windows 8, JDK1.7 etc.).
e.g
Sample code:

LoadOptions options = new LoadOptions();

options.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);


Workbook workbook = new Workbook(“BigDataXLSX_1200Rows_10Cols_500Chars.xls
”, options);


Thank you.

Hi Amjad,


Thanks for your reply.

Your configuration is same as mine except the JDK version, I am using the JDK 1.6 . Still I face the problem. Here is my code,

LoadOptions lOpt = new LoadOptions();
lOpt.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(stream, lOpt);

The CPU hits when executing the third line, which is constructing the Workbook from a stream.

Hi Jai,

Thanks for your posting and using Aspose.Cells for Java.

We have tested this issue on JDK 1.6. The CPU usage goes to 40% for just a micro second and goes to 6-10% later. And it all took a 3-4 seconds. We think it is normal. Your file also contains large amount of data from range A1:ED1500, these are almost 134x1500 = 201000 cells so that is taking a little more CPU usage.