473,386 Members | 1,715 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,386 software developers and data experts.

How to make time-costing web service Asynchronous?

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

Jun 28 '07 #1
1 2270
On Wed, 27 Jun 2007 18:28:56 -0700, Morgan Cheng
<mo************@gmail.comwrote:
[...]
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?
Well, one solution would be to create your own thread pool, independent
from the main application thread pool, and use that to service your
requests. That way, those time-consuming requests don't eat up the main
thread pool. Of course, it still makes sense to not let your special
thread pool get too big (25 threads per CPU is a nice number), and so if
you get too many of those requests, they will wind up queued. But at
least they won't be interfering with other types of requests.

Alternatively, you could just have a single non-pool thread (or maybe a
much smaller pool, with a number of threads equal to the number of CPUs,
plus a couple) that services a queue of those requests. After all, if the
requests are CPU-bound (you said it's not i/o), it's not like having 25
threads per-CPU is going to make things faster (in fact, it will make
things slower). Better to just put them all in a queue and process them
sequentially.

Pete
Jun 28 '07 #2

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

Similar topics

31
by: Bruce W...1 | last post by:
This is a best practices question. For a website where PHP is used, does it make sense to have both .htm and .php files? In other words, for pages that have no active content there's no point...
7
by: lawrence | last post by:
2 Questions: 1.) Can anyone think of a way to speed up this function? It is terribly slow. I plan to reduce the number of directories to 3, which I guess will speed it up in the end. 2.) This...
3
by: Susan Bricker | last post by:
Greetings. I have three forms that are open at the same time. They are related and cascading. The first form (frmEventAdd) is the anchor. Each event can have many Trials. The second form is...
19
by: Swaregirl | last post by:
Hello, I would like to build a website using ASP.NET. I would like website visitors to be able to download code that I would like to make available to them and that would be residing on my...
2
by: inquiringMind | last post by:
My academic background is a Master's In Chemistry, and course work in - Undergraduate level classes of Intro C++, Java, Data Structure, Web development using HTML, JavaScript, Perl, JSP...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
7
by: John Harrison | last post by:
This is from SGI's FAQ, its the justification for why list<T>::size() is linear time in their library (and in gcc library too since their code is based on SGI) <quote> Why is list<>::size()...
5
by: clairelee0322 | last post by:
I am a C++ beginner and I am working on a C++ project that calucates the phone bill. I got stuck on how to make every 60 minutes into one hour.. Like if the user enter 1000 (10:00) and it asks for...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.