Ask a questionAsk a question
 

AnswerOptimization of data service?

  • Thursday, September 24, 2009 4:55 PMJake Wardley Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am building a web site  using data service against entity framework and I want to  improve the performance of this web application, I hope that one expert can explain how can I  make this web app run fast and faster.

    Thanks.

Answers

  • Thursday, October 29, 2009 10:36 AMBineesh AV Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Couple of suggestions

    1) Use Database View : Do not expand child properties at the client side if multiple tables are involved in the query. create a view in the database and update the entity model then query against the view will save lot of time.

    2)Response Filter :

     protected void Application_BeginRequest(object sender, EventArgs e)
            {
                Response.Filter = new DataServiceResponseFilter(Response.Filter);
            }

    Write your filter to remove unnecessary strings from xml response. This is just a workaround to make the data coming back from server lean
    the Data Services team can provid better ways to optimize the reponse size (compression etc)
    I am doing the following filtering and stil ldata services works fine (and lot faster)
                 Regex re = new Regex("(<link).*(/>)");
                content = re.Replace(content, "");

                re = new Regex("(<id>).*(</id>)");
                content = content.Replace("  ", "");
                content = content.Replace("\r", "");
                content = content.Replace("\n", "");


    The major performance pain point is the size of xml generated for each entity in the response xml. Hope Microsoft will provide a compression option soon
    Or atlease allow us to decompress data at client side (compressing data at client side is possible with Reponse filters or httpmodules)

    3)Do Batch Updates.

    4) use projections (CTP 2)

    Thanks & Regards

    Bineesh AV


    • Marked As Answer byJake Wardley Thursday, November 12, 2009 8:54 PM
    •  

All Replies

  • Thursday, October 29, 2009 10:36 AMBineesh AV Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Couple of suggestions

    1) Use Database View : Do not expand child properties at the client side if multiple tables are involved in the query. create a view in the database and update the entity model then query against the view will save lot of time.

    2)Response Filter :

     protected void Application_BeginRequest(object sender, EventArgs e)
            {
                Response.Filter = new DataServiceResponseFilter(Response.Filter);
            }

    Write your filter to remove unnecessary strings from xml response. This is just a workaround to make the data coming back from server lean
    the Data Services team can provid better ways to optimize the reponse size (compression etc)
    I am doing the following filtering and stil ldata services works fine (and lot faster)
                 Regex re = new Regex("(<link).*(/>)");
                content = re.Replace(content, "");

                re = new Regex("(<id>).*(</id>)");
                content = content.Replace("  ", "");
                content = content.Replace("\r", "");
                content = content.Replace("\n", "");


    The major performance pain point is the size of xml generated for each entity in the response xml. Hope Microsoft will provide a compression option soon
    Or atlease allow us to decompress data at client side (compressing data at client side is possible with Reponse filters or httpmodules)

    3)Do Batch Updates.

    4) use projections (CTP 2)

    Thanks & Regards

    Bineesh AV


    • Marked As Answer byJake Wardley Thursday, November 12, 2009 8:54 PM
    •