Performance - Pages loading slow due to docks

3 posts, 0 answers
  1. Shubod Dev
    Shubod Dev avatar
    15 posts
    Member since:
    Sep 2008

    Posted 17 Jun 2009 Link to this post

    We are using raddocks reading content from database and displaying on webpages, such pages load 5X slower than a normal page.
    The docks on your website load fast, Is this an issue with improper implmenting on our code ?

    Here's our code. Please let us know how we can improve performance. Thanks, Shubod



    DEFAULT.ASPX

    <telerik:raddocklayout runat="server" id="RadDockLayout25">
      <telerik:raddockzone runat="server" id="RadDockZone251" FitDocks="true" width="90%" MinHeight="200px" BackColor="Transparent" BorderWidth="1px" BorderStyle="1" BorderColor="Transparent" style="float:left;margin-right:15px; margin-bottom:15px;" HighlightedCssClass="MyHighlight">
       <telerik:raddock runat="server" id="RadDock2511" title="PageContent defined"  text="" Width="100%" EnableEmbeddedSkins="true" Skin="Hay" DockMode="Docked" Resizable="true">
        <contenttemplate>
        </contenttemplate>
       </telerik:raddock>
       <telerik:raddock runat="server" id="RadDock2512" title="Content defined"  text="" Width="100%" EnableEmbeddedSkins="true" Skin="Hay" DockMode="Docked" Resizable="true">
        <contenttemplate>
        </contenttemplate>
       </telerik:raddock>
      </telerik:raddockzone>
     </telerik:raddocklayout>
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    DEFAULT.ASPX.VB

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      CMSLibrary.DockContentReader.GetContent(RadDock2512,"Content defined","Newclient",ConString,"../../","stage03.tsunami.aptinet.com")
      CMSLibrary.DockContentReader.GetPageContent(RadDock2511,"PageContent defined","Newclient",ConString)
    End Sub
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    LIBRARY.VB

        Public Shared Sub GetPageContent(ByRef PlaceContentTo As RadDock, ByVal DockName As String, ByVal ClientName As String, ByVal ConString As String)
            Dim Odb As New CMSDatabase(ConString)
            Dim lblContent As New Label
            Dim StructureID As String = Odb.ExecuteScaler("SELECT DockDataID FROM [" & ClientName & "].[dbo].[DockContentData] WHERE [DockContentName] like '" & DockName & "' and Type = " & DockType.PageContent)
            Dim PageDockContent As String = Odb.ExecuteScaler("SELECT ISNULL([InnerHTML], '') FROM [" & ClientName & "].[dbo].Content WHERE [StructureId] = " & StructureID)
            lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.PageContent.ToString
            lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
            'lblContent.Width = Unit.Percentage(100)
            lblContent.Style("padding") = "10px"
            If Not PageDockContent Is Nothing Then
                lblContent.ID = lblContent.ID & StructureID
                PageDockContent = Text.RegularExpressions.Regex.Replace(PageDockContent, "\[DockPlaceHolder[^\]]+?]", "")
                lblContent.Text = PageDockContent
            Else
                lblContent.ID = lblContent.ID & "0"
                lblContent.Text = " "
            End If
            PlaceContentTo.ContentContainer.Controls.Add(lblContent)
        End Sub
    ..........................................................................................................................................................................................................................................................................................................................................................................................

        Public Shared Sub GetContent(ByRef PlaceContentTo As RadDock, ByVal DockName As String, ByVal ClientName As String, ByVal ConString As String, ByVal PagePosition As String, ByVal WebsiteURL As String)
            Dim Odb As New CMSDatabase(ConString)
            Dim lblContent As Label
            Dim SqlString As String = ""
            Dim odt As DataTable
            Dim odr As DataRow

            SqlString = "SELECT CD.ContentDocksID, CD.Description FROM DockContentData AS DC INNER JOIN ContentDocksData AS CD ON DC.DockDataID = CD.ContentDocksID WHERE DC.DockContentName like '" & DockName & "' and DC.Type = " & DockType.Content & " and CD.Status = " & DockContentStatus.Enabled & " and CD.Show = " & DockContentShow.Yes & " order by CD.Created desc"

            'SqlString = "select ContentDocksID, Title, description from [" & ClientName & "].[dbo].ContentDocksData where (convert(datetime,convert(varchar(12),Expiry)) >= convert(datetime,convert(varchar(12), getdate())) or convert(datetime,convert(varchar(12),Expiry))='1900-01-01 00:00:00.000') "
            'SqlString &= " and Status=" & DockContentStatus.Enabled & " and Show=" & DockContentShow.Yes & " order by Created desc"

            If Odb.IsExist(SqlString) Then
                odt = Odb.GetDataTable(SqlString)
                For Each odr In odt.Rows
                    Dim GetFullPageDockContent As String = Trim("" & odr.Item("Description"))
                    If GetFullPageDockContent <> "" Then
                        'GetFullPageDockContent = Replace(GetFullPageDockContent, "../UserControls/Handler.ashx?path=" & ClientName & "/", PagePosition, , , CompareMethod.Text)
                        GetFullPageDockContent = Replace(GetFullPageDockContent, "../UserControls/Handler.ashx?path=" & ClientName, "http://" & WebsiteURL, , , CompareMethod.Text)
                        lblContent = New Label
                        lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.Content.ToString & "_" & odr.Item("ContentDocksID")
                        lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
                        'lblContent.Width = Unit.Percentage(98)
                        lblContent.Style.Add("padding", "10px")
                        lblContent.Text = GetFullPageDockContent
                        PlaceContentTo.ContentContainer.Controls.Add(lblContent)
                    End If
                Next
            Else
                lblContent = New Label
                lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.Content.ToString & "_0"
                lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
                'lblContent.Width = Unit.Percentage(98)
                lblContent.Style.Add("padding", "10px")
                lblContent.Text = " "
                PlaceContentTo.ContentContainer.Controls.Add(lblContent)
            End If
        End Sub

  2. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 19 Jun 2009 Link to this post

    Depending on the size of the strings being manipulated, all that string concatenation / replacing could be really slow.
  3. Petko
    Admin
    Petko avatar
    45 posts

    Posted 19 Jun 2009 Link to this post

    Hi apb,

    The same support ticket, posted by Ali Faraji , was  answered. For your inconvenience I'm posting the reply here:
    "In my opinion, the problem is caused by the database. You can try to load a static page (with the same number of docks and the same content) without using a database, and then see how fast the page will load.
    If the problem still persists, please, send us more detailed information (page loading time with and without database, the nature of dock content, how many rows your database table have, etc.) and if possible - your running project, where we can observe the issue.
    Once we receive it , we will do our best to provide you a solution.
    "


    Best wishes,
    Petko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top