473,788 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.BeginI nvoke 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 2291
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.BeginI nvoke 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
3850
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 in naming them with a .php extension. Is there any advantage or disadvantage to making all files .php, or the same for mixing them with .htm files? What do you do, and why?
7
2676
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 seems to be the brute force method, and I'm wondering if anyone can think of a better strategy. I've been asked to make life easy on graphic designers by not making assumptions about where I might find the files that the software might need to...
3
6826
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 frmTrialInfo. Each Trial can have three Classes. The third form is frmClassInfo. These forms are used for update and adding new records. The user displays an event for update (frmEventAdd). Then clicks on a button to display the Trials for that event...
19
2284
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 personal server. Are there any code samples or books that someone can recommend so that I can implement this. I would prefer VB.NET code, but I am willing to convert from C# if necessary.
2
1304
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 Servlets, Software Engineering and - SWEN classes (include a course in UML, a course in Testing, Vaeification, and Validation), Data Base Management System, Web Database Development using ASP, Distributed Information System, Object-Oriented Ddatabase,...
19
2446
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; //every class may have this statement self.hello = function() {
15
6522
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
7
1635
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() linear time? The size() member function, for list and slist, takes time proportional to the number of elements in the list. This was a deliberate tradeoff. The only way to get a constant-time size() for linked lists would be to
5
1892
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 the length of your phone call, if the user enters 70, the program has to print out the result time (end_time) 1110 here's my program, hope you guys can help me out!! Thanks alot!
1
47489
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.