We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

W3wp high cpu usage


We are using Aspose.Word component on IIS 6 web server.

Since we start using it (in production environment, a lot of users) we are facing a problem of 100% cpu in w3wp.exe process.

The 100% cpu has ups and downs but it can stack the server for 5 minutes sometimes.

The server has 1GB memory and task manager indicates that around 500MB are in use.

The application get a lot of data from sql server, placing the data in around 10 data sets and transfer the data sets to word document through mail merging (each merging label separately).

Do you have any ideas how to reduce CPU usage?

Thank you


Thanks for your request. It is difficult to say what the reason is. Memory and CPU usage varies depending on the document complexity and size of data you are inserting into the document.

Maybe you can run this process in another thread and after finishing notify client that generation is completed.

Also, I don not recommend generating large Word document. It is better to use few small document instead one huge.

Best regards.


The document size is around 1MB (average of 30 pages, each page has around 70 merging tags).

What do you consider as large document?

I think we should consider 10-20Mb document as huge. It also depend on the document complexity.

If the data source consists of multiple rows, the whole template is repeated for each data row and every repeated copy is populated with the corresponding data. That’s why the generated document might be very big.

Could you please attach your template here? I will test it on my side and see how it goes.

Best regards.

Please find one of our tmplates attached

The template is generated for group of 40 people (1 page for each user so the final document will have 40 pages)


Thanks for your request. I use the following code for testing:

Document doc = new Document(@"Test120\in.doc");

//Get names of mergefiedl in the document
string[] names = doc.MailMerge.GetFieldNames();

//Build table that contains 40 records
DataTable dt = new DataTable();
foreach (string name in names)
    if (!dt.Columns.Contains(name))

object[] values = names;
if (dt.Columns.Count != names.Length)
    values = new object[dt.Columns.Count];
    for (int i = 0; i < values.Length; i++)
        values[i] = "test";

//Add 40 rows
for (int i = 0; i < 40; i++)

//Execute mail merge
//Save document

The code is executed very fast. It takes less than second to generate the document. Maybe data processing in your application takes more time than document generation.

Best regards.


It takes us around 15 seconds to generate a document because we collect and analyze a lot of data.

Could the high CPU problem happen because many users generate those kinds of documents in parallel?
I guess we have like 50 users who do it together (together I mean in a time scale of a few minutes)

How much memory do you think we should have in order to work fast to those 50 users?



Thanks for your request. Yes, if many users generate the document simultaneously it could cause high CPU usage problem.

You can test this on your side. Just run generating of the document in several threads simultaneously.

Best regards.