This is a migrated thread and some comments may be shown as answers.

RadGrid performance issues

7 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clement
Top achievements
Rank 1
Clement asked on 24 Jan 2012, 05:10 PM

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

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Jan 2012, 05:51 AM
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.
0
Clement
Top achievements
Rank 1
answered on 25 Jan 2012, 05:47 PM
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
0
Tsvetina
Telerik team
answered on 30 Jan 2012, 04:40 PM
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
0
Clement
Top achievements
Rank 1
answered on 08 Feb 2012, 03:58 PM

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;
        }     
    }
}

0
Tsvetina
Telerik team
answered on 13 Feb 2012, 01:01 PM
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 >>
0
Curtis
Top achievements
Rank 1
answered on 29 Nov 2012, 10:00 PM
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.
0
Pavlina
Telerik team
answered on 04 Dec 2012, 04:43 PM
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.
Tags
Grid
Asked by
Clement
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Clement
Top achievements
Rank 1
Tsvetina
Telerik team
Curtis
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or