WCF Client Performance Using ObjectDataSource

WCF Client Performance

So everyone knows that WCF clients incur more overhead than their predecessor proxy clients.  The penalty comes from establishing a connection to the WCF service and somewhat depends on the binding you have configured.  Some bindings are more expensive than others, but there is more overhead regardless.  Also, you know that now you have to be responsible for closing your proxy client.  Previously you could just instantiate a proxy instance, call method(s) and let the garbage collector do the rest. A logical and easy way to provide a speedup is to instantiate one client object and save it as a private member variable of your page, usercontrol, etc.  This prevents you from having to create/close more than one client.

ObjectDataSource

If you use an ObjectDataSource with a TypeName of a WCF proxy client, then it will be instantiating a WCF client and incurring the same overhead.  It is pretty common to find more than one ODS on a page, in fact I have seen pages with a dozen or more.  Also, it is common to find multiple ObjectDataSources referencing the same service.  So it is quite easy to see a performance gain from making your ODSources use one client instance.  How?  The ObjectDataSource exposes two critical events that make this speedup possible, and even easy:

Advertisements
This entry was posted in ASP.NET, Technology, WCF. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s