473,809 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asynchronous web methods

hs
H
I am using the articles by Matt Powell about server side asynchronous web methods (as well as the client side article)
However i dont see any improvements to the speed of my application. I'm experiencing the
slow speed on the server side. I read that using a delegate to call an asynchronous metho
would be ineffecient and maybe causing the problem. Can someone give me some advice on wha
i can do to improve the speed without doing a complete rewrite (my code was based on a
synchronous piece)

Thank

server side cod
---------------
public delegate string ProcessMessageX ML3AsyncStub(st ring asMessage)

public class MyStat

public object previousState
public ProcessMessageX ML3AsyncStub asyncStub
[WebMethod
public IAsyncResult BeginProcessMes sageXML3(string asMessage,Async Callback cb, object s

ProcessMessageX ML3AsyncStub stub = new ProcessMessageX ML3AsyncStub(Pr ocessMessageXML 3)
MyState ms = new MyState()
ms.previousStat e = s
ms.asyncStub = stub

return stub.BeginInvok e(asMessage, cb, ms)
[WebMethod
public string EndProcessMessa geXML3(IAsyncRe sult call

MyState ms = (MyState)call.A syncState
return ms.asyncStub.En dInvoke(call)
public string ProcessMessageX ML3(string asMessage

// Go to database and fill datatabl
OleDbConnection dbconn = new OleDbConnection ("Provider=MSDA ORA.1;User ID=SQL;Password =SQL;Data Source=TestDB")
OleDbDataAdapte r da = new OleDbDataAdapte r("SELECT * FROM Table1", dbconn)
DataTable dt = new DataTable()
da.Fill(dt)

this.dt = dt

if(dt.Rows.Coun t > 100

Thread newThread = new Thread(new ThreadStart(thi s.CreateMoreThr eads))
newThread.Start ()
MemoryStream ms = CreateStream(th is.dt, 0, 100)
// Do some more IO stuf
..

return "something"
private void CreateMoreThrea ds(

// Create even more threads depending on the number of records returne
// and do more IO stuf

Client sid
----------
private void button2_Click(o bject sender, System.EventArg s e

this.webservice 1 = new localhost.Servi ce1()
this.ds = new DataSet()

AsyncCallback callback = new AsyncCallback(t his.ServiceCall back)

this.webservice 1.BeginProcessM essageXML3(text Box4.Text, callback, null);
private void ServiceCallback (IAsyncResult result

localhost.Servi ce1 ws = new localhost.Servi ce1()
string s1 = ws.EndProcessMe ssageXML3(resul t)

object[] args = {s1}
this.Invoke(new ProcessStringDe legate(ProcessS tring), args)
public delegate void ProcessStringDe legate(string as1)

private void ProcessString(s tring as1

// Process the string her
Jul 21 '05 #1
1 2030
Hello,

Thanks for your post. I reviewed your description and web methods
client/server code carefully, and now I'd like to share the following
information with you:

1. I believe that your design is good and efficient. I noticed that you
code is based on asynchronous web methods on both client and server sides.
It also seems to me that your client program is a WinForm application, and
I believe using a delegate to call the web method is a nice approach which
will not block the message thread for the client. That is, your application
is responsive while the web method is under processing (after user clicking
Button2). On the server side, it access Oracle database which is
time-consuming.

2. >> However i dont see any improvements to the speed of my application.

One reason why the asynchronous method call enables the performance is that
we can perform several tasks simultaneously. For example, your client
application is responsive and can perform other tasks when the web method
is processing on the remote system. If your application is just idle and
waiting for the delegate to be called, there is no difference between
synchronous and asynchronous method calls in terms of performance. It's of
the same case on server side, we are able to notice the performance
increase when there are several web methods calls coming in simultaneously.

Please feel free to let me know if you have any problems or concerns.

Have a nice day! :-)

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2

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

Similar topics

1
1557
by: Julian Hershel | last post by:
Reading about asynchronous programming (ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconasynchronousdesignpatterno verview.htm) I could not clarify some doubts. Hope you can help me. 1) Are asynchronous programming and multithreaded programming two different pictures? As I read the help topic above it is not clear to me if the design pattern opens a new thread or not to run the methods asynchronously. 2) One unique thread can run...
5
4607
by: rgarf | last post by:
I have a C++ application that consumes a web service. I would like to call the web service asynchronously so my C++ application can do other processing in between. My proxy file does not have any asynchronous methods in it, What do I have to do to get my proxy file to have the asynchronous methods to call? Thanks
1
3175
by: org | last post by:
Hi, I'm developing a web service with should be used by an .NET CF2 client and an .NET 2.0 Windows client. I've tried to put all the connection logic into one class, which could be used in common from the mobile and the windows client. But this didn't work: The new .NET framework supports asynchronous web services with the "MethodnameCompleted+=new MethodNameEventHandler pattern, but the "old style" .NET 1 pattern used in the compact...
4
3823
by: taskswap | last post by:
I have a legacy application written in C that I'm trying to convert to C#. It processes a very large amount of data from many clients (actually, upstream servers - this is a mux) simultaneously. I've read through what must be dozens of ways to do socket communication in C#, and it seems they all devolve into three basic options - Socket.Select, IOCP through a native interface, and Asynchronous callbacks. I'm fine using Asynchronous...
1
2880
by: dba123 | last post by:
I need to perform Asynchronous Inserts using DAAB. So far I have a method which does an insert but how can I do this Asyncronously so that it does not affect the load on our public production website? This question is wide open but make sure you give me some ideas in context with DAAB syntax. Some thoughts are threading, ATLAS, etc. but I have no clue how to even approach an Asynchronous Insert or any techniques at this point. Also, I...
5
15513
by: HugeBob | last post by:
Hi All, I've got a question about Asynchronous vs Synchronous mode with the XMLHttpRequest object. What are the ramifications of using one mode vs the other? If the script uses Asynchronous mode, it sounds as if a thread retrieves the data from the supplied URL and the JS function that called the open() and send() methods continues on. Where as using Synchronous mode the method that called open() and send() waits until the data from...
1
3044
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of the web service methods. What I like about the asynchronous calls that they use events. So when I call the web service operation is finished is fires the event. So all my objects that I'm using in my client application just subscribe to whatever...
1
1777
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of the web service methods. What I like about the asynchronous calls that they use events. So when I call the web service operation is finished is fires the event. So all my objects that I'm using in my client application just subscribe to whatever...
4
1406
by: Varangian | last post by:
Hello, the subjects says much I think. Basically I want to create my own long running tasks asynchronously. I want to have a BeginMyOwnLongTediousMethod and EndMyOwnLongTediousMethod You know like the framework already has the methods of BeginExecuteReader that return an IAsynchResult.
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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
10378
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
10391
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,...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
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
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.