Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2006

Tip: Looking for answers? Try searching our database.

Performance issues on Web Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
antijape@gmail.com - 22 Mar 2006 15:08 GMT
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?
Pandurang Nayak - 23 Mar 2006 00:03 GMT
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
Signature

blog: www.thinkingMS.com/pandurang

> I have a Web Service that returns very large string object. The string
> contais xmldata fetched directly from sql server by using xml explicit.
[quoted text clipped - 59 lines]
> localhost. Does anyone have any ideas why it's taking so long and maybe
> how it could be fixed?
antijape@gmail.com - 23 Mar 2006 08:19 GMT
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?
Pandurang Nayak - 23 Mar 2006 17:33 GMT
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
Signature

blog: www.thinkingMS.com/pandurang

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.