HighTechTalks DotNet Forums  

Performance issues on Web Service

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Performance issues on Web Service in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Performance issues on Web Service - 03-22-2006 , 08:08 AM






I have a Web Service that returns very large string object. The string
contais xmldata fetched directly from sql server by using xml explicit.
The thing here is that if I get xml-document that is 11mb without web
service it takes about 2 minutes. With web service it takes about 5min.
This is acceptable. But when I get 37mb document without web service it
takes about 5-6min but with web service it takes about 50min! As you
can see this doesn't quite match up... The calls are excactly the same,
so the problem isn't there. On the bigger document sqlserver does a
little more work, but still (according to task manager) it's the web
service that takes 80-90% of the time.

The call is like this:
Dim ws As New webservice
ws.Timeout = System.Threading.Timeout.Infinite
str = ws.getData
Dim sw As StreamWriter = New StreamWriter("c:\Temp\data.xml",
False)
sw.Write(str)
sw.Close()

and the web service is like this:
Dim conn As New SqlConnection(connstr)
Dim sqlcom As New SqlCommand
Dim sqlre As SqlDataReader

sqlcom.CommandType = CommandType.StoredProcedure
sqlcom.Connection = conn
sqlcom.CommandTimeout = 1200
sqlcom.CommandText = "getData"
conn.Open()
sqlre =
sqlcom.ExecuteReader(CommandBehavior.CloseConnecti on)
While sqlre.Read
str = str & sqlre(0)
End While
--then close and return str

I've also tried it like this:
Private connec As ADODB.Connection
Private comm As New ADODB.Command
<XmlIgnore()> Private objStream As New ADODB.Stream
<XmlIgnore()> Public str As String

------

connec = Me.GetConnection()
comm.CommandType = CommandType.StoredProcedure
comm.CommandTimeout = 1200
comm.ActiveConnection = connec
comm.CommandText = "getData"
objStream.Open()
comm.Properties("Output Stream").Value = objStream
objStream.Position = 0
comm.Execute(, , 1024)
str = objStream.ReadText
--then close and return str

but it's the same with this way too. Webmethod also has the
"BufferResponse:=False" set. The return object could be xmldocument
also, but if I've understood correctly returning string is better and
then construct the xmldocument on client-side. The webservice is on
localhost. Does anyone have any ideas why it's taking so long and maybe
how it could be fixed?


Reply With Quote
  #2  
Old   
Pandurang Nayak
 
Posts: n/a

Default RE: Performance issues on Web Service - 03-22-2006 , 05:03 PM






IIS is probably recycling because all the while you are holding the document
in memory.

Web services are really not the ideal tool for what you are trying to do -
but then that is a design discussion.

Regards,
Pandurang
--
blog: www.thinkingMS.com/pandurang


"antijape (AT) gmail (DOT) com" wrote:

Quote:
I have a Web Service that returns very large string object. The string
contais xmldata fetched directly from sql server by using xml explicit.
The thing here is that if I get xml-document that is 11mb without web
service it takes about 2 minutes. With web service it takes about 5min.
This is acceptable. But when I get 37mb document without web service it
takes about 5-6min but with web service it takes about 50min! As you
can see this doesn't quite match up... The calls are excactly the same,
so the problem isn't there. On the bigger document sqlserver does a
little more work, but still (according to task manager) it's the web
service that takes 80-90% of the time.

The call is like this:
Dim ws As New webservice
ws.Timeout = System.Threading.Timeout.Infinite
str = ws.getData
Dim sw As StreamWriter = New StreamWriter("c:\Temp\data.xml",
False)
sw.Write(str)
sw.Close()

and the web service is like this:
Dim conn As New SqlConnection(connstr)
Dim sqlcom As New SqlCommand
Dim sqlre As SqlDataReader

sqlcom.CommandType = CommandType.StoredProcedure
sqlcom.Connection = conn
sqlcom.CommandTimeout = 1200
sqlcom.CommandText = "getData"
conn.Open()
sqlre =
sqlcom.ExecuteReader(CommandBehavior.CloseConnecti on)
While sqlre.Read
str = str & sqlre(0)
End While
--then close and return str

I've also tried it like this:
Private connec As ADODB.Connection
Private comm As New ADODB.Command
XmlIgnore()> Private objStream As New ADODB.Stream
XmlIgnore()> Public str As String

------

connec = Me.GetConnection()
comm.CommandType = CommandType.StoredProcedure
comm.CommandTimeout = 1200
comm.ActiveConnection = connec
comm.CommandText = "getData"
objStream.Open()
comm.Properties("Output Stream").Value = objStream
objStream.Position = 0
comm.Execute(, , 1024)
str = objStream.ReadText
--then close and return str

but it's the same with this way too. Webmethod also has the
"BufferResponse:=False" set. The return object could be xmldocument
also, but if I've understood correctly returning string is better and
then construct the xmldocument on client-side. The webservice is on
localhost. Does anyone have any ideas why it's taking so long and maybe
how it could be fixed?



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Performance issues on Web Service - 03-23-2006 , 01:19 AM



Thanks for the answer Pandurang. Isn't there really anything I can do
about this? Maybe I could get the data in chunks, but since Biztalk and
several other instances are included, it would be quite time consuming
to build the solution... Any ideas?


Reply With Quote
  #4  
Old   
Pandurang Nayak
 
Posts: n/a

Default Re: Performance issues on Web Service - 03-23-2006 , 10:33 AM



Why don't you look at FTP or something? There is good FTP support in Windows
2003 and .NET 2.0.

You could create a FTP site and this Web Service could "trigger" a FTP
upload of the file. I think you could then use some FileWatcher
component-based logic to raise required events when the file is transferred.

Just an idea without really knowing your requirements.

Regards,
Pandurang
--
blog: www.thinkingMS.com/pandurang


"antijape (AT) gmail (DOT) com" wrote:

Quote:
Thanks for the answer Pandurang. Isn't there really anything I can do
about this? Maybe I could get the data in chunks, but since Biztalk and
several other instances are included, it would be quite time consuming
to build the solution... Any ideas?



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.