RadGrid performance issues

8 posts, 0 answers
  1. Clement
    Clement avatar
    6 posts
    Member since:
    Nov 2011

    Posted 24 Jan 2012 Link to this post

    Hello techies,

    We are using the RagGrid on a test page for performance testing.
    We were surprised to notice that a simple page with 100 elements in the GRID takes on an average about 2 seconds. We are doing a load test on Win Server 2008 R2. We are not using a real database. We are using a STUB to generate the 100 odd elements.
    The same STUB when used on ASP.net MVC page with simple HTML table rendering out performs the RadGrid Page. The MVC page takes about 0.37 seconds.

     

    Test Environment : ASP.net 4.0 / RadControls for ASP.NET AJAX Q2 2011 SP1 / Windows Server 2008 R2 / IIS 7.5  / Application pool type “Integrated Pipeline”

    Any ideas?

     

    Advance thanks,
    Clement
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jan 2012 Link to this post

    Hello,

    You can go through the following help link which expalins about tips to optimize RadGrid performance.
    Client/server grid performance optimizations

    You can also consider ajaxifying your grid to improve performance as described in the following help link.
    Ajaxifying RadGrid

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Clement
    Clement avatar
    6 posts
    Member since:
    Nov 2011

    Posted 25 Jan 2012 Link to this post

    Hello Princy,

    Thanks for your feedback.
    This how we proceeded

    1. Switched off the ViewSate complete for the Grid
    2. Set false to EnableEmbeddedSkins
    2. Enabled RadCompression HttpModule in the system.web & system.webserver as said in the documents.
    3. Added RadScriptManager & RadStyleSheetManager.
    4. Activated Compression on IIS for dynamic & static content.

    But still the average response time is more than a second.
    Where as MVC & Web Forms with Gridview loads pretty fast.

    Awaiting your inputs.

    Regards,
    Clement
  5. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 30 Jan 2012 Link to this post

    Hi Clement,

    Can you please paste your RadGrid declaration? We will review it and if needed test it to let you know what exactly cuts down performance.

    Regards,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Clement
    Clement avatar
    6 posts
    Member since:
    Nov 2011

    Posted 08 Feb 2012 Link to this post

    Thanks for the reply. Can find the details below (ASPX, Code-Behind, DAL Class).
    Awaiting your feedback.

    Here is the ASPX
    ----------------------
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="telerikgrid.aspx.cs" Inherits="MVC_WF.telerikgrid" %>

    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" Runat="server">
            </telerik:RadStyleSheetManager>
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            </telerik:RadScriptManager>
            RadGrid1<br />
            <telerik:RadGrid ID="RadGrid1" runat="server"               
            ClientSettings-AllowAutoScrollOnDragDrop="false"
            ClientSettings-AllowColumnHide="false"       
            ClientSettings-AllowColumnsReorder="false"
            ClientSettings-AllowExpandCollapse="false"
            ClientSettings-AllowGroupExpandCollapse="false"
            ClientSettings-AllowKeyboardNavigation="false"
            ClientSettings-AllowRowHide="false"
            ClientSettings-AllowRowsDragDrop="false"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowCustomPaging="false"
            AllowFilteringByColumn="false"
            AllowMultiRowEdit="false"
            AllowMultiRowSelection="false"
            AllowPaging="false"
            AllowSorting="false">
            </telerik:RadGrid>

            RadGrid2<br />
            <telerik:RadGrid ID="RadGrid2" runat="server"
               ClientSettings-AllowAutoScrollOnDragDrop="false"
            ClientSettings-AllowColumnHide="false"       
            ClientSettings-AllowColumnsReorder="false"
            ClientSettings-AllowExpandCollapse="false"
            ClientSettings-AllowGroupExpandCollapse="false"
            ClientSettings-AllowKeyboardNavigation="false"
            ClientSettings-AllowRowHide="false"
            ClientSettings-AllowRowsDragDrop="false"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowCustomPaging="false"
            AllowFilteringByColumn="false"
            AllowMultiRowEdit="false"
            AllowMultiRowSelection="false"
            AllowPaging="false"
            AllowSorting="false">
            </telerik:RadGrid>

            RadGrid3<br />
            <telerik:RadGrid ID="RadGrid3" runat="server"
               ClientSettings-AllowAutoScrollOnDragDrop="false"
            ClientSettings-AllowColumnHide="false"       
            ClientSettings-AllowColumnsReorder="false"
            ClientSettings-AllowExpandCollapse="false"
            ClientSettings-AllowGroupExpandCollapse="false"
            ClientSettings-AllowKeyboardNavigation="false"
            ClientSettings-AllowRowHide="false"
            ClientSettings-AllowRowsDragDrop="false"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowCustomPaging="false"
            AllowFilteringByColumn="false"
            AllowMultiRowEdit="false"
            AllowMultiRowSelection="false"
            AllowPaging="false"
            AllowSorting="false">
            </telerik:RadGrid>

            RadGrid4<br />
            <telerik:RadGrid ID="RadGrid4" runat="server"
               ClientSettings-AllowAutoScrollOnDragDrop="false"
            ClientSettings-AllowColumnHide="false"       
            ClientSettings-AllowColumnsReorder="false"
            ClientSettings-AllowExpandCollapse="false"
            ClientSettings-AllowGroupExpandCollapse="false"
            ClientSettings-AllowKeyboardNavigation="false"
            ClientSettings-AllowRowHide="false"
            ClientSettings-AllowRowsDragDrop="false"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowCustomPaging="false"
            AllowFilteringByColumn="false"
            AllowMultiRowEdit="false"
            AllowMultiRowSelection="false"
            AllowPaging="false"
            AllowSorting="false">
            </telerik:RadGrid>

            RadGrid5<br />
            <telerik:RadGrid ID="RadGrid5" runat="server"
               ClientSettings-AllowAutoScrollOnDragDrop="false"
            ClientSettings-AllowColumnHide="false"       
            ClientSettings-AllowColumnsReorder="false"
            ClientSettings-AllowExpandCollapse="false"
            ClientSettings-AllowGroupExpandCollapse="false"
            ClientSettings-AllowKeyboardNavigation="false"
            ClientSettings-AllowRowHide="false"
            ClientSettings-AllowRowsDragDrop="false"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowCustomPaging="false"
            AllowFilteringByColumn="false"
            AllowMultiRowEdit="false"
            AllowMultiRowSelection="false"
            AllowPaging="false"
            AllowSorting="false">
            </telerik:RadGrid>
       
        </div>
        </form>
    </body>
    </html>

    Here is the code behind
    -------------------------------

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using App_Fabric_IIS_StartUp.Models;

    namespace App_Fabric_IIS_StartUp
    {
        public partial class telerikgrid : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
                    bool viewstate = false;
                    if (!string.IsNullOrEmpty(Request.QueryString["viewstate"]))
                    {
                        if (Request.QueryString["viewstate"].ToString() == "1")
                            viewstate = true;
                        else
                            viewstate = false;
                    }
                    SetViewState(viewstate);
                    //SetEmbeddedSkins(viewstate);
                }
                catch
                {

                }

                if (!IsPostBack)
                {
                    List<Product> vList = new List<Product>();
                    vList = DAL.GetProducts(true);

                    RadGrid1.DataSource = vList;
                    RadGrid2.DataSource = vList;
                    RadGrid3.DataSource = vList;
                    RadGrid4.DataSource = vList;
                    RadGrid5.DataSource = vList;

                    RadGrid1.DataBind();
                    RadGrid2.DataBind();
                    RadGrid3.DataBind();
                    RadGrid4.DataBind();
                    RadGrid5.DataBind();
                }
            }

            private void SetViewState(bool pViewState)
            {
                RadGrid1.EnableViewState = pViewState;
                RadGrid2.EnableViewState = pViewState;
                RadGrid3.EnableViewState = pViewState;
                RadGrid4.EnableViewState = pViewState;
                RadGrid5.EnableViewState = pViewState;
            }

            private void SetEmbeddedSkins(bool pViewState)
            {
                RadGrid1.EnableEmbeddedSkins = pViewState;
                RadGrid2.EnableEmbeddedSkins = pViewState;
                RadGrid3.EnableEmbeddedSkins = pViewState;
                RadGrid4.EnableEmbeddedSkins = pViewState;
                RadGrid5.EnableEmbeddedSkins = pViewState;
            }
        }
    }

    Here is the DAL Class
    ----------------------------

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using App_Fabric_IIS_StartUp.Models;

    namespace App_Fabric_IIS_StartUp
    {
        public class DAL
        {
            public static List<Product> GetProducts(bool pFakeData)
            {
                List<Product> list = new List<Product>();
                if (pFakeData)
                {
                    for (int cnt = 1; cnt <= 100; cnt++)
                    {
                        Product item = new Product();
                        item.ProductID = cnt;
                        item.ProductName = "Product Name" + cnt.ToString();
                        item.UnitPrice = ((decimal)(cnt * 5));
                        item.UnitsInStock = cnt * 3;
                        list.Add(item);
                    }
                }
                else
                {

                    NorthwindEntities db = new NorthwindEntities();
                    var lists = (from prod in db.Products
                                 select prod).ToList();

                    foreach (Products pr in lists)
                    {
                        Product pro = new Product();
                        pro.ProductID = pr.ProductID;
                        pro.ProductName = pr.ProductName;
                        pro.UnitPrice = (decimal)pr.UnitPrice;
                        pro.UnitsInStock = (int)pr.UnitsInStock;
                        list.Add(pro);
                    }
                }
                return list;
            }     
        }
    }

  7. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 13 Feb 2012 Link to this post

    Hello Clement,

    Indeed your grid setup seems optimized, can you please mention what is the record count in the grids and in total on the page when you notice the slowdown?
    Also, try disabling RadGrid's embedded resources to confrim that there is no slowdown related to loading of unneeded scripts:
    http://www.telerik.com/help/aspnet-ajax/introduction-disabling-embedded-resources.html

    Greetings,
    Tsvetina
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. Curtis
    Curtis avatar
    23 posts
    Member since:
    Jan 2008

    Posted 29 Nov 2012 Link to this post

    Does setting all the fields like Clement does above to false actually help or are most disabled by default? Whenever I have done what he did above, I didn't notice much of a difference in script size or anything else.

    I have 6 grids on a page that all have their own purpose and am trying to figure out how to optimize them best. Turning off the ViewState hasn't been an option because when I tried that, I couldn't get the the export feature to return any rows even though the data was always bound in NeedDataSource.

    Here's a sample Grid:

    <telerik:RadGrid ID="gridMessages"
        runat="server"
        AllowFilteringByColumn="false"
        ShowGroupPanel="false"
        AllowSorting="false"
        ShowStatusBar="true"
        AllowPaging="true"
        PageSize="50"
        OnNeedDataSource="gridMessages_NeedDataSource"
        EnableHeaderContextMenu="false">
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <GroupingSettings CaseSensitive="false" />
    <ClientSettings AllowDragToGroup="false"><Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling></ClientSettings>
    <ExportSettings Excel-Format="ExcelML" ExportOnlyData="true" OpenInNewWindow="true" FileName="BulkImportMessages" IgnorePaging="true"></ExportSettings>
    <MasterTableView RetrieveAllDataFields="false" CommandItemDisplay="Top" AutoGenerateColumns="true" ShowHeadersWhenNoRecords="true" UseAllDataFields="true">
    <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToPdfButton="true" ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowExportToWordButton="true" />
    <Columns>
    </Columns>
    <NoRecordsTemplate>No matching records.</NoRecordsTemplate>
    </MasterTableView>
    </telerik:RadGrid>

    How can that be optimized as optimization is absolutely key for this page with so many grids? Any one of the 6 grids could be bound to as many as 3000 rows of data with as many as 40 columns.

    Thanks.
  9. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 04 Dec 2012 Link to this post

    Hello,

    You can refer to the following article for useful hints about how to optimize the RadGrid performance:
    http://www.telerik.com/help/aspnet-ajax/grid-viewstate-reduction-techniques.html

    Regards,
    Pavlina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017