• 0

[C#] soap is slow


Question

I was just noticing while transferring my binary files from my database my network utilization was only running about about 5.26%. Is there a reason .NET doesn't use 100% of your bandwidth when you are calling a web soap call? I'm transferring PDF files (which can avg about 6 MB per file) and it is agonizingly slow. The call is super fast for calls that the file is 500 KB or less. I have the feeling if it was really transferring the soap call as quickly as it could the network % would be 100 would it not?

Link to comment
https://www.neowin.net/forum/topic/1072085-c-soap-is-slow/
Share on other sites

14 answers to this question

Recommended Posts

  • 0

I was just noticing while transferring my binary files from my database my network utilization was only running about about 5.26%. Is there a reason .NET doesn't use 100% of your bandwidth when you are calling a web soap call? I'm transferring PDF files (which can avg about 6 MB per file) and it is agonizingly slow. The call is super fast for calls that the file is 500 KB or less. I have the feeling if it was really transferring the soap call as quickly as it could the network % would be 100 would it not?

Your assumption sir, is incorrect.

  • 0

SOAP isn't really designed for large files. It's supposed to be for messaging between endpoints. I would recommend using SOAP to expose a URL for the file and using normal HTTP or other methods for transferring the files.

This article may help some: http://msdn.microsoft.com/en-us/library/aa480521.aspx

  • Like 2
  • 0

I just spent the last couple months implementing a java soap web service in an asp.net application (it took so long because the group that wrote it either didn't care or didn't know that it didn't work in anything except java applications, and they had to fix it). All the service does is return either an image (as a byte array) or a URL to the image. Most of the images are less than 200KB, but there's a few that are over 1MB, and those take noticeably longer to retrieve and this is an internal intranet site. Like GreyWolf said, it'd be better to expose the URL to the file you want instead of actually returning the file, but if this is not an option, then you just have to work with what you have.

  • 0

Well all of the PDFs are stored as a byte array in a database. So I guess in theory I could save a tmp file and then expose the url to that tmp file. I'm guessing then use another method to download that file. The question is would that create more overhead then the way it's already being done?

  • 0

Well all of the PDFs are stored as a byte array in a database. So I guess in theory I could save a tmp file and then expose the url to that tmp file. I'm guessing then use another method to download that file. The question is would that create more overhead then the way it's already being done?

That's exactly what I did with the images that were coming back. I saved them on the server, then returned the direct URL to that image. There shouldn't be much (if any) overhead doing this other than the amount of time it'd take to save the file and finish the post back.

  • 0

Well all of the PDFs are stored as a byte array in a database. So I guess in theory I could save a tmp file and then expose the url to that tmp file. I'm guessing then use another method to download that file. The question is would that create more overhead then the way it's already being done?

I would say store the PDFs on a server with an accessible URL and store the address in the database. Did you check out the MSDN article I linked earlier? It has a number of suggestions on how to handle exactly what you're trying to do.

This article about SOAP + Attachments is referenced in the MSDN one but the link is old. It may be helpful as well.

  • 0

Sorry I should have mentioned I did look at those articles and they are really interesting. I'm going to go with the WCF MTOM route I think and re-design the core transfer functions. I don't know much about WCF but it looks really similar to regular web service (.asmx) coding. Or I may do the URL part I'm not sure. So many options lol. I really like the idea of the files being stored as a byte array blob in the database but if that just isn't a good practice maybe I should re-consider my methods. Because WCF will be basically the same thing just with a slightly more optimized method of transporting the xml file if I am not mistaken? MTOM just is an optimized method of transferring binary parts via soap message right?

  • 0

can you return sockets from web services to write data to?

You can, but there can be issues with it. Check the section labeled "Other Hybrid Approaches" in that article. :)

In reference to MTOM: http://msdn.microsof...y/aa528822.aspx

If your client and server are both using .NET you might also look into using remoting.

  • 0

I think part of the problem with the method I am currently using is that I may have my app.config setup incorrectly. There is a way I've heard to change how much data gets buffered / sent at once. So in theory if my internet can handle 1.2 MB/s then I could buffer 1.2MB then send it off as one chunk right?

  • 0

I think part of the problem with the method I am currently using is that I may have my app.config setup incorrectly. There is a way I've heard to change how much data gets buffered / sent at once. So in theory if my internet can handle 1.2 MB/s then I could buffer 1.2MB then send it off as one chunk right?

Theoretically; but I wouldn't advise it

This topic is now closed to further replies.
  • Posts

    • It's really pathetic that an MMA video game triggers your political rage...
    • Nvidia GeForce NOW gains support for seven more games as discounts continue by Pulasthi Ariyasinghe There's a brand-new update rolling out to Nvidia's GeForce NOW streaming service, and like every week, that means more games have received support on the platform. This week's drop has additions like Aphelion and Pro Cycling Manager 26 attached to it. Don't forget that the GeForce NOW summer sale is still active too. This limited-time offer drops the 12-month Performance membership from $99.99 to $64.99, saving members $35. At the same time, the 12-month Ultimate membership is currently going for $129.99, dropping the price by $70 from the original $199.99. Moreover, Nvidia reiterated that support for GOG single sign-in and game library is incoming this summer, joining stores like Steam, Ubisoft Connect, Battle.net, and Xbox. "Connect supported game store accounts and stream titles with GeForce RTX power. Games that include cloud-save functionality help keep progress intact across devices," added the company. "Start a game on one screen, pick up where playtime left off on another, and spend less time managing installs and storage space." Here are the games joining GeForce NOW's supported list this week: Embers of the Uncrowned Demo (New release on Steam, available 13) Pro Cycling Manager 26 (New release on Steam, available June 15) Aphelion (Steam) Citizen Sleeper (Epic Game Store, Free from June 18-25) Megastore Simulator (Steam) OPERATOR (Steam) Super Meat Boy 3D (Xbox, available on Game Pass) Keep in mind that, unlike subscription services like Game Pass or EA Play, a copy of a game must be owned by the GeForce NOW member (or at least have a license via PC Game Pass) to start playing via Nvidia's cloud servers. There is also a limit to how many hours subscribers can use the service per month, with extra time being purchasable in chunks.
    • 47% profit margin? Wtf!! I know companies are in business to make money but come on man. I know for a fact I'll never own one of these.
    • Most AI-powered mainframe migration vendors expected to fail by 2030, Gartner warns by Paul Hill Credit: Pexels You may have read that many companies still run code written in ancient programming languages like COBOL and pay a handsome sum for those who can maintain that code. Well, it looks like this area of the tech world could be the scene of an AI bubble. It turns out that there are mainframe exit vendors, helping companies move their legacy mainframe systems to modern cloud environments or servers such as Microsoft Azure and AWS, using generative AI tooling. Unfortunately, 75% of these vendors are now expected to pivot or cease operations as market realities take hold by 2030. Alessandro Galimberti from Gartner said: Some of the companies in the mainframe exit market are IBM, 21CS, BMC, Broadcom, Rocket Software, DXC, GTSG, and Kyndryl. The reasons some of these firms are expected to quit the market are a reset of market expectations and a decline in demand for one-size-fits-all migration solutions. The reset in expectations is likely to be driven by cost overruns and threats to business, and the potential occurrence of critical failures within businesses as a result of bad transition implementations. These insights from Gartner are pretty interesting because it’s a specific area of the market where doubt is being cast on generative AI. Many people have cast doubt on whether AI companies will successfully justify the massive amounts spent on GenAI to date, and this data from Gartner suggests the road could be rocky for GenAI.
  • Recent Achievements

    • Week One Done
      Classifyskilleducation earned a badge
      Week One Done
    • One Month Later
      eurospharma62 earned a badge
      One Month Later
    • Week One Done
      With What earned a badge
      Week One Done
    • Week One Done
      Harris Gilbert earned a badge
      Week One Done
    • One Month Later
      Vincian earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      532
    2. 2
      +Edouard
      166
    3. 3
      PsYcHoKiLLa
      72
    4. 4
      neufuse
      64
    5. 5
      ATLien_0
      63
  • Tell a friend

    Love Neowin? Tell a friend!