Performance issues on Web Service

A

antijape

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.CloseConnection)
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?
 
P

Pandurang Nayak

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
 
A

antijape

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?
 
P

Pandurang Nayak

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top