473,406 Members | 2,620 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,406 software developers and data experts.

Problem: Huge overhead from making asynchronous SOAP calls...

In a newly created test app, to maximize client performance I tried to
make two SOAP method calls in tandem (the soap methods execute some
specified query), as each call includes a large amount of idle time by
the client as it waits for a query to execute and return a dataset.

As a test, I initially wrote two versions:
' // Sequential & Synchronous
Dim webobj As com.mycompany.webobject
Dim ds1 As System.Data.DataSet
Dim ds2 As System.Data.DataSet
webobj = new com.mycompany.webobject
ds1 = webobj.Test("qry_1")
ds2 = webobj.Test("qry_2")
MsgBox "Done!"
' // Asynchronous
Dim webobj As com.mycompany.webobject
Dim arQry1 As IAsyncResult
Dim arQry2 As IAsyncResult
Dim ds1 As System.Data.DataSet
Dim ds2 As System.Data.DataSet
webobj = new com.mycompany.webobject
arQry1 = webobj.BeginTest("qry_1", Nothing, Nothing)
arQry2 = webobj.BeginTest("qry_2", Nothing, Nothing)
ds1 = webobj.EndTest(arQry1)
ds2 = webobj.EndTest(arQry1)
MsgBox "Done!"

.....

Query 1 returns about 18,000 rows while Query 2 returned about 200.
The surprising result was that the asynchronous way took about 30
seconds while the synchronous way took about 13.

As a reality check, I then changed Query 2 to a longer running query
which returned about 10,000 rows. I also created a third,
multi-threaded version of the test. Each thread calls the SYNCHRONOUS
SOAP method and for the most part, it should be approximately the same
as the asynchronous version.

As expected, the multi-threaded version outperforms the sequential
version. But even with TWO long-running queries, the asynchronous
version STILL underperforms the sequential version!
Someone suggested updating the file machine.config with
maxconnections="10" (from "2") but this had no effect in my cas.

Any ideas as to what's going on? I have no problems creating a
multi-threaded application if that's what it takes, but for
maintainability I'd rather keep the code as simple as possible if I
can.

Thanks!

Nov 21 '05 #1
3 3974
Hi,

A synchronous doesnt let anything else run until that call is done.
An asynchronous call runs in the background so it takes longer. The biggest
advantage of asynchronous call is that the function call will not lock up
the computer and make it seam unresponsive.

Ken
------------
<us***********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
In a newly created test app, to maximize client performance I tried to
make two SOAP method calls in tandem (the soap methods execute some
specified query), as each call includes a large amount of idle time by
the client as it waits for a query to execute and return a dataset.

As a test, I initially wrote two versions:
' // Sequential & Synchronous
Dim webobj As com.mycompany.webobject
Dim ds1 As System.Data.DataSet
Dim ds2 As System.Data.DataSet
webobj = new com.mycompany.webobject
ds1 = webobj.Test("qry_1")
ds2 = webobj.Test("qry_2")
MsgBox "Done!"
' // Asynchronous
Dim webobj As com.mycompany.webobject
Dim arQry1 As IAsyncResult
Dim arQry2 As IAsyncResult
Dim ds1 As System.Data.DataSet
Dim ds2 As System.Data.DataSet
webobj = new com.mycompany.webobject
arQry1 = webobj.BeginTest("qry_1", Nothing, Nothing)
arQry2 = webobj.BeginTest("qry_2", Nothing, Nothing)
ds1 = webobj.EndTest(arQry1)
ds2 = webobj.EndTest(arQry1)
MsgBox "Done!"

.....

Query 1 returns about 18,000 rows while Query 2 returned about 200.
The surprising result was that the asynchronous way took about 30
seconds while the synchronous way took about 13.

As a reality check, I then changed Query 2 to a longer running query
which returned about 10,000 rows. I also created a third,
multi-threaded version of the test. Each thread calls the SYNCHRONOUS
SOAP method and for the most part, it should be approximately the same
as the asynchronous version.

As expected, the multi-threaded version outperforms the sequential
version. But even with TWO long-running queries, the asynchronous
version STILL underperforms the sequential version!
Someone suggested updating the file machine.config with
maxconnections="10" (from "2") but this had no effect in my cas.

Any ideas as to what's going on? I have no problems creating a
multi-threaded application if that's what it takes, but for
maintainability I'd rather keep the code as simple as possible if I
can.

Thanks!
Nov 21 '05 #2
I would whole-heartedly agree, except for the following:
- Most of the processing time is on the back-end server, which is IIS
(for the SOAP call) and SQL Server (for the database query).
- I created a third, multi-threaded version which makes two SOAP calls
at once; neither SOAP calls are on the main thread, which means both
threads are effectively in the background.

However, in my multi-threaded version I put the main thread to sleep
for 0.3 seconds between checks. To see what I mean...

' // WebObjWrapper wraps the SOAP object
com.mycompany.webobject
' // and adds covenience functions for threading.
Dim qry1 As com.mycompany.WebObjWrapper
Dim qry2 As com.mycompany.WebObjWrapper
Dim thrd1 As System.Threading.Thread
Dim thrd2 As System.Threading.Thread
Dim time1 As System.DateTime
Dim time2 As System.DateTime

qry1 = New com.mycompany.WebObjWrapper("qry_1")
qry2 = New com.mycompany.WebObjWrapper("qry_2")

thrd1 = New Thread(AddressOf qry1.ThreadProc)
thrd2 = New Thread(AddressOf qry2.ThreadProc)

thrd1.Start()
thrd2.Start()

While (Not qry1.IsFinished Or Not qry2.IsFinished)
Thread.Sleep(300)
End While

ds1 = qry1.DataSet
ds2 = qry2.DataSet
MsgBox("Done")
Perhaps it's possible that in the asynchronous version, the main thread
is soaking up a lot more processing power?

Nov 21 '05 #3
FYI for anyone that's curious:
http://msdn.microsoft.com/library/de...netchapt10.asp
Note You should not use asynchronous Web methods when accessing a

database. ADO.NET does not provide asynchronous implementation for
handling database calls. Wrapping the operation in a delegate is not an
option either because you still block a worker thread.

I'm not sure what's the difference internally (client OR server)
between making a synchronous and asynchronous call, but apparently
ADO.NET isn't happy with asynchronous calls.

Thanks.

Nov 21 '05 #4

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

Similar topics

2
by: Li Ma | last post by:
Just want to share my experience on XML-RPC. We were working on a messaging middleware. We were using XML-RPC as communication protocol amoing client apps and server. Client could be written by...
0
by: Zach Tong | last post by:
Hi all, I've got a minor problem that I think deals with synchronization. I've got asynchronous socket code working on my server. When it recieves a command, it will call the follow function to...
7
by: David Sworder | last post by:
Hi, I'm developing an application that will support several thousand simultaneous connections on the server-side. I'm trying to maximize throughput. The client (WinForms) and server communicate...
2
by: Darryl A. J. Staflund | last post by:
Hi there, Can anyone tell me why invoking a single SQL insert statement (well, rather, a method that performs a SQL insert) using an asynchronous delegate should result in twice the number of...
0
by: Jonathan Trevor | last post by:
Hi, I've found what appears to be a bug with ASP.NET web service method invocation - making it impossible to invoke and get the result of a synchronous web call after an asynchronous call has...
1
by: Byungchul Lee | last post by:
Hello. I'm making a small web service program (with a small web-server component, without ASP.Net). I made a server and a client and client calls the service with invoke method. But I have a...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
3
by: Peter Longstaff | last post by:
Hi All, I am having trouble with my first effort at developing a web service. I have a methods, outlined below which should return a DataTable. public DataTable...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.