+ Start a Discussion
ColoradoMikeColoradoMike 

Performance problems using .NET with Salesforce API?

Hello,

I have a .NET based application that seems to be having performance problems and I think it may have to do with .NET's handling of threads for calling web services.

Has anyone else had .NET performance problems (in a heavily used application) or any tips regarding .NET?  Should we be using the GZip compression wrapper (found elsewhere on this site) even with .NET 2.0?

Thanks for your tips!

Mike
SuperfellSuperfell
Always use compression. for .NET 2.0 see this post.
http://www.pocketsoap.com/weblog/2006/12/1717.html

.NET also applies the HTTP spec rules about 2 connections per host by default, so if you have lots of concurrent threads, you might see a lot of blocking while they wait for a HTTP connection. If you're running into this, then IIRC, you can change the 2 per host limit via a property on the ServicePoint object.
ColoradoMikeColoradoMike
Thanks, Simon.  That's exactly what I thought might be going on.

I've found quite a lot of information about this situation... here's a pretty in-depth article in case anyone else is battling this.
http://blogs.msdn.com/tess/archive/2006/02/23/asp-net-performance-case-study-web-service-calls-taking-forever.aspx

It turns out to be a config item in your machine.config or web.config:
    <connectionManagement>
        <add address="*" maxconnection="2" />
    </connectionManagement>

Now the question is, what would be the ideal value for the maxconnection?  I'm sure it depends on the number of CPUs.  Also, I'm guessing that I really would need to put in an "<add>" entry for each Salesforce server (and set it to a pretty high value), but leave the "*" default entry to something pretty low.

Hey Simon, one more question:  have you done any work around consuming web services  (Salesforce) asynchronously?  That could be a huge boost to performance, I suppose.  Here's another article about it:
http://msdn2.microsoft.com/en-us/library/aa480507.aspx

Any further thoughts on this would be greatly appreciated.

Mike

Message Edited by ColoradoMike on 10-05-2007 10:06 AM

SuperfellSuperfell
Its hard to say what the number should be without knowing a lot more about your app, you don't want it too high, otherwise you run the risk of triggering the salesforce.com side concurrent requests limits.

Here's a quick note I did on async stuff for query/queryMore (this is using .NET 1.1)
ColoradoMikeColoradoMike
From the looks of the API, it looks like the only concurrent request limit (as of this writing) is for DE accounts (and the limit is 5 concurrent requests).

If that's not right or I'm unaware of other limits, would you let me know?

Thanks also for the link to the asynch tool regarding queryMore.
ColoradoMikeColoradoMike
The connection management changes you suggested Simon appear to be doing the trick -- many thanks on that.

One question that comes up though, has to do with the correct host/ip address to grant a higher number of connections to.  I set my server to allow a higher connection limit to "na1.salesforce.com", "na1-api.salesforce.com", etc. for all of the salesforce servers (both ui servers and api servers.).

However, now that I'm monitoring TCP traffic from my server, I also see connections to servers like "na1-sjl.salesforce.com" and "na1-api-sjl.salesforce.com".

Would you recommend that I allow a great number of connections to the "sjl" servers too?  What are those, anyway?