locked
Performance implication of using Expand method on WCF Data Service Client RRS feed

  • Question

  • Hi

    We are considering to use “Expand” method to load related entities in our asp.net application that is a WCF Data Service client.

    We would like to know few details about “Expand” method wrt performance before we start using it.

    How does “Expand” method work? Does it perform table scan while joining/loading related entities? Is there any performance implication if some entities involves near a million rows?

    In most scenarios, while using “Expand” method, we are expecting legitimate data on client side.

    Typical Scenario: Somewhere around 500 rows with 10 fields from 3 to 4 entities.

    Max Scenario: Somewhere around 1000 rows with 10 fields from 3 to 4 entities.

    As an alternate, do you suggest using client side joins between list of entities?

    We appreciate your help in this regard.

    Thanks

    Hitesh

    Thursday, May 26, 2011 3:38 PM

Answers

  • The reason I ask is because if its using Entity Framework then the queries essentially will use EF's include. Eventually the linq query given to the server will be translated to a Tsql. There are a number of things to take into consideration here.

    Below is a link to an msdn article about EF perf

    http://msdn.microsoft.com/en-us/library/cc853327.aspx

    Also in this link above it links to a blog post that goes over in better detail how EF works (along with a second post as well)

    http://blogs.msdn.com/b/adonet/archive/2008/02/04/exploring-the-performance-of-the-ado-net-entity-framework-part-1.aspx

    So if you are using EF under the covers I would read these various articles and they might give you some ideas.

    Another thing you can do as well is capture the tsql that is generated when a query is run, you can run queries with and with out the expand in them and see how they differ and then use Sql Server to investigate these tsql queries. You should be able to see the queries that have been run against sql server.

    Now if you have your own provider or not EF then typically you would need to implement IExpandProvider. At that point the performance characteristics are very dependent on your particular provider implementation.

    Thanks,

    Chris Robinson


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, May 27, 2011 4:26 PM
    Moderator

All replies

  • Hey Hitesh,

    What underlying data provider are you using? Are you using EF?

    Thanks,

    Chris Robinson


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, May 27, 2011 12:26 AM
    Moderator
  • The reason I ask is because if its using Entity Framework then the queries essentially will use EF's include. Eventually the linq query given to the server will be translated to a Tsql. There are a number of things to take into consideration here.

    Below is a link to an msdn article about EF perf

    http://msdn.microsoft.com/en-us/library/cc853327.aspx

    Also in this link above it links to a blog post that goes over in better detail how EF works (along with a second post as well)

    http://blogs.msdn.com/b/adonet/archive/2008/02/04/exploring-the-performance-of-the-ado-net-entity-framework-part-1.aspx

    So if you are using EF under the covers I would read these various articles and they might give you some ideas.

    Another thing you can do as well is capture the tsql that is generated when a query is run, you can run queries with and with out the expand in them and see how they differ and then use Sql Server to investigate these tsql queries. You should be able to see the queries that have been run against sql server.

    Now if you have your own provider or not EF then typically you would need to implement IExpandProvider. At that point the performance characteristics are very dependent on your particular provider implementation.

    Thanks,

    Chris Robinson


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, May 27, 2011 4:26 PM
    Moderator
  • Thanks for the reply Chris! Yes, we are using Entity Framework. I am sure these articles will help. We shall provide these references to our data service team.

    Hitesh

    Friday, May 27, 2011 10:08 PM