473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Web Garden and multithreading query

I've got an ASP.NET application that runs Word macros after a user submits
it to the website. A web service written in C# does the work. Many users
can submit Word documents at any one time. However, the application only
processes 1 Word document at a time.

I had a problem during testing when several users submitted 10 documents
each at the same time. At a point (user1: 7 docs; user2: 4 docs; user3: 7
docs; user4: 5docs) the server reported the following error after clicking
'Validate': HTTP status code 504 - no response from remotes server. Server
responded after trying again 5 minutes later. However, despite the error
message emails were received for these documents.

My application adds to the thread pool like this:

// Call asynchronously method that does work that takes time
WaitCallback doWork = new WaitCallback( StartBackgroundService );

// Then return true if successfully started.
return ThreadPool.QueueUserWorkItem( doWork, allocateInfo );

I want to avoid the 'HTTP status code 504 - no response from remotes server'
error message. Therefore, I increased the Maximum number of worker
processes to 50. Then when I tested submitting documents one after the
other in quick succession, I found the number of worker threads increase to
50 on the webserver. I haven't yet got the users to test submitting many
documents at the same time yet.

From what I understand of a Web Garden is that it is a thread pool and the
threads share their workload out with one another. Does this increase the
availability of the website, i.e. avoid any timeout errors like above? If
the thread pool reaches its maximum size of 50 what happens when users
submit more documents? How is the thread pool maintained at 50? Is one
thread killed and another started or is one recycled automatically? I have
increased the timeout of threads to 300 minutes because some large Words
documents take a long time to process.

Basically my question is, does increasing the size of the Web Garden
increase the availability of a website for concurrent users? State is not
important for me because this site performs back-end processing. A front
end web site send the document to the back end site.
Nov 19 '05 #1
8 1570
This sounds like a good opportunity to implement MSMQ to avoid these kinds of
problems.

"techie" wrote:
I've got an ASP.NET application that runs Word macros after a user submits
it to the website. A web service written in C# does the work. Many users
can submit Word documents at any one time. However, the application only
processes 1 Word document at a time.

I had a problem during testing when several users submitted 10 documents
each at the same time. At a point (user1: 7 docs; user2: 4 docs; user3: 7
docs; user4: 5docs) the server reported the following error after clicking
'Validate': HTTP status code 504 - no response from remotes server. Server
responded after trying again 5 minutes later. However, despite the error
message emails were received for these documents.

My application adds to the thread pool like this:

// Call asynchronously method that does work that takes time
WaitCallback doWork = new WaitCallback( StartBackgroundService );

// Then return true if successfully started.
return ThreadPool.QueueUserWorkItem( doWork, allocateInfo );

I want to avoid the 'HTTP status code 504 - no response from remotes server'
error message. Therefore, I increased the Maximum number of worker
processes to 50. Then when I tested submitting documents one after the
other in quick succession, I found the number of worker threads increase to
50 on the webserver. I haven't yet got the users to test submitting many
documents at the same time yet.

From what I understand of a Web Garden is that it is a thread pool and the
threads share their workload out with one another. Does this increase the
availability of the website, i.e. avoid any timeout errors like above? If
the thread pool reaches its maximum size of 50 what happens when users
submit more documents? How is the thread pool maintained at 50? Is one
thread killed and another started or is one recycled automatically? I have
increased the timeout of threads to 300 minutes because some large Words
documents take a long time to process.

Basically my question is, does increasing the size of the Web Garden
increase the availability of a website for concurrent users? State is not
important for me because this site performs back-end processing. A front
end web site send the document to the back end site.

Nov 19 '05 #2
i'd go with that suggestion. you shouldn't increase the threadpool to 50.
That will cause resource contention IMO

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET
-------------------------------------------------------

"Brad Roberts" <Br*****************@hotmail.com> wrote in message
news:57**********************************@microsof t.com...
This sounds like a good opportunity to implement MSMQ to avoid these kinds of problems.

"techie" wrote:
I've got an ASP.NET application that runs Word macros after a user submits it to the website. A web service written in C# does the work. Many users can submit Word documents at any one time. However, the application only processes 1 Word document at a time.

I had a problem during testing when several users submitted 10 documents
each at the same time. At a point (user1: 7 docs; user2: 4 docs; user3: 7 docs; user4: 5docs) the server reported the following error after clicking 'Validate': HTTP status code 504 - no response from remotes server. Server responded after trying again 5 minutes later. However, despite the error message emails were received for these documents.

My application adds to the thread pool like this:

// Call asynchronously method that does work that takes time
WaitCallback doWork = new WaitCallback( StartBackgroundService );

// Then return true if successfully started.
return ThreadPool.QueueUserWorkItem( doWork, allocateInfo );

I want to avoid the 'HTTP status code 504 - no response from remotes server' error message. Therefore, I increased the Maximum number of worker
processes to 50. Then when I tested submitting documents one after the
other in quick succession, I found the number of worker threads increase to 50 on the webserver. I haven't yet got the users to test submitting many documents at the same time yet.

From what I understand of a Web Garden is that it is a thread pool and the threads share their workload out with one another. Does this increase the availability of the website, i.e. avoid any timeout errors like above? If the thread pool reaches its maximum size of 50 what happens when users
submit more documents? How is the thread pool maintained at 50? Is one
thread killed and another started or is one recycled automatically? I have increased the timeout of threads to 300 minutes because some large Words
documents take a long time to process.

Basically my question is, does increasing the size of the Web Garden
increase the availability of a website for concurrent users? State is not important for me because this site performs back-end processing. A front end web site send the document to the back end site.

Nov 19 '05 #3
On Thu, 1 Sep 2005 18:06:23 +0100, "techie" <te****@nospam.biz> wrote:

I want to avoid the 'HTTP status code 504 - no response from remotes server'
error message. Therefore, I increased the Maximum number of worker
processes to 50. Then when I tested submitting documents one after the
other in quick succession, I found the number of worker threads increase to
50 on the webserver. I haven't yet got the users to test submitting many
documents at the same time yet.

You should only see as many worker processes as you have CPUs - I'm
not sure if you are talking about worker processes or worker threads.

From what I understand of a Web Garden is that it is a thread pool and the
threads share their workload out with one another.
No - webgardens are a way to dedicate a worker process to run on a
specific CPU in a multi-proc machine. The advantage is this: when the
operating system schedules a thread in the process to run, it will
execute on the same CPU it saw during it's last time slice and will
probably be able to use some cached data in the CPU.

Basically my question is, does increasing the size of the Web Garden
increase the availability of a website for concurrent users?


I think in your case I'd look for a queuing mechanism, as suggested by
others. Word automation is notoriously ugly for server side work.

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4
"techie" <te****@nospam.biz> wrote in message
news:tP********************@biscit.net...
I've got an ASP.NET application that runs Word macros after a user submits
it to the website. A web service written in C# does the work. Many users
can submit Word documents at any one time. However, the application only
processes 1 Word document at a time.


Some other things to consdier ...
http://support.microsoft.com/default...;EN-US;q257757

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
Nov 19 '05 #5

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:c2********************************@4ax.com...
On Thu, 1 Sep 2005 18:06:23 +0100, "techie" <te****@nospam.biz> wrote:

I want to avoid the 'HTTP status code 504 - no response from remotes server'error message. Therefore, I increased the Maximum number of worker
processes to 50. Then when I tested submitting documents one after the
other in quick succession, I found the number of worker threads increase to50 on the webserver. I haven't yet got the users to test submitting many
documents at the same time yet.

You should only see as many worker processes as you have CPUs - I'm
not sure if you are talking about worker processes or worker threads.


I'm getting confused with worker threads. The webserver has 2 CPUs.
Therefore I've now set the Maximum number of worker processes to 2. There
is a noticeable improvement in performance from being at 1.

The webserver hosts 7 sites all of which share the same DefaultAppPool.
Should there be 7 different app pools, one for each site? Currently all 7
sites share the same app pool that now has 2 worker processes.
From what I understand of a Web Garden is that it is a thread pool and thethreads share their workload out with one another.
No - webgardens are a way to dedicate a worker process to run on a
specific CPU in a multi-proc machine. The advantage is this: when the
operating system schedules a thread in the process to run, it will
execute on the same CPU it saw during it's last time slice and will
probably be able to use some cached data in the CPU.

Basically my question is, does increasing the size of the Web Garden
increase the availability of a website for concurrent users?


I think in your case I'd look for a queuing mechanism, as suggested by
others. Word automation is notoriously ugly for server side work.


In my case there isn't a need to use any other queuing mechanism such as
MSMQ. My application already processes submissions one at a time, i.e.
queuing is already implemented.
--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #6
On Fri, 2 Sep 2005 04:11:14 +0100, "techie" <te****@nospam.biz> wrote:

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:c2********************************@4ax.com.. .
On Thu, 1 Sep 2005 18:06:23 +0100, "techie" <te****@nospam.biz> wrote:
>
>I want to avoid the 'HTTP status code 504 - no response from remotesserver' >error message.


Let's take a different approach.

Where do you see the 504 error - on the client?

You mentioned using a web service from your ASP.NET code, have you
bumped up the maxconnection parameter?

http://odetocode.com/Blogs/scott/arc...06/08/272.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #7
Ollie - Limiting the number of threads created is a good thing, as it
may tax your system eventually... but creating asynch threads doesn't
take away from the thread pool used by the worker process. It is my
understanding they are from a differernt pool.

Regards
Coleman

Nov 19 '05 #8
I haven't tried this suggestion yet.

I think I could use caching because the error is probably being caused by
too many simultaneous requests to the same web page. The webserver is
unable to respond to all concurrent requests at the same and hence the
timeout message. I'm a bit new to ASP.NET but I've read that you can
implement caching by adding the following line at the top of your .aspx
page:

<%OutputCache Duration="600" VaryByParam="*"%>

If I do this, does the server always serve the same page irrespective of the
Word file the user submits to the website? Ideally the server will cache a
number of versions of the same page, depending on my input, and the logic is
still executed each time. (My input is a MS Word file which is bound to
differ for every submission).

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:ij********************************@4ax.com...
On Fri, 2 Sep 2005 04:11:14 +0100, "techie" <te****@nospam.biz> wrote:

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:c2********************************@4ax.com.. .
On Thu, 1 Sep 2005 18:06:23 +0100, "techie" <te****@nospam.biz> wrote:

>
>I want to avoid the 'HTTP status code 504 - no response from remotes

server'
>error message.


Let's take a different approach.

Where do you see the 504 error - on the client?

You mentioned using a web service from your ASP.NET code, have you
bumped up the maxconnection parameter?

http://odetocode.com/Blogs/scott/arc...06/08/272.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Warren | last post by:
I'm having some difficulty getting controls to work with multithreading. Basically, I want to begin a long running operation on another thread when a button is clicked, and then disable that button...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
2
by: shonend | last post by:
**** sorry about the length of the message. If you can't read the whole thing and still willing to help, read the last 2 paragraphs where the main problem is described. The introduction story is...
2
by: Multithreading problem in vb.net | last post by:
Greetings, I am new to multithreading and I am trying to implement it in my app. This application is distributed application which needs to refresh every say 5 secs to show some activities in...
4
by: boo73uk | last post by:
Hi All, I'm going to rewrite a VB6 app to VB.net and I need some pointers. Basically this app spawns simultaneous,multiple, independant ActiveX.exe 'workers' which query a SQL Server database and...
5
by: Benny | last post by:
I have a ASP.NET webservice and it is configured to run in a web garden with multiple processes. Whan a process in the garden is launched, I want the process to create a background thread. When...
1
by: RSH | last post by:
Hi, I have a situation in where I have a main loop that queries a "Parent" Global database table. Based on that resultset I loop through all of the databases and the appropriate table in the...
0
by: srikmr | last post by:
I have a scenario which needs some expert advice from people who worked on multithreading in C#. Here is the scenario: I have an Application (Let’s name it as MyApplication) which is invoked by...
5
by: Cramer | last post by:
I think I understand *what* a Web garden is (app running on a server with multiple processors). But what's the benefit? I have googled this and have found only articles that describe WHAT and HOW...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.