Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

How to make time-costing web service Asynchronous?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Morgan Cheng - 28 Jun 2007 02:29 GMT
I have one webservice that involves time-costing computation. For each
request, it consumes about 2 seconds computation. Since ASP.NET has 25
threads per CPU to handle requests, this delay turns to be bottleneck
if webservice is synchronous. Say, the webserivce is called ABC, then
one thread is arranged for one call to ABC, and the thread is not
released until the result is returned.

I once configured to implement it as Asynchronous webmethod. That is,
implement BeginABC and EndABC webmethod. But, it seems asynchronous
webmethod only fit for handle I/O or invocation to other webservice.
The time-costing computation is local and is not I/O. So,
Delegate.BeginInvoke is used; but this also involves ThreadPool and no
benefits at all.

Any idea to design such time-costing-computation webserivce with high
throughput?
Thanks in advance.
Morgan
bruce barker - 28 Jun 2007 17:16 GMT
if the work can not be sent to another server, then starting a new
thread only makes it worse.

as long as you have more threads than cpus you will max the throughput.
 if you want the waits to be less queued (but longer for each request)
then bump up the number of asp.net threads. you overall thoughput will
be less (more context switches), but the request will be served fairly.

as you are compute bound there is no magic bullet. say you have a 4 proc
server, and 12 concurrent request. you have 24 secs of cpu, which can be
done in 6 secs if all 4 procs work at the same time. if you had 4
threads, then request would take 2 secs to process and be first come
first served. so some would be return in 2 secs, some in 4 secs, and
some after 6. if you had 12 threads, then all would return after 6 seconds.

your best bet is to lower the cost to < 1 sec by recoding the computation.

-- bruce (sqlwork.com)

> I have one webservice that involves time-costing computation. For each
> request, it consumes about 2 seconds computation. Since ASP.NET has 25
[quoted text clipped - 14 lines]
> Thanks in advance.
> Morgan

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.