• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Jazzsingh
#1 Posted : Monday, February 2, 2009 10:02:33 AM(UTC)
Jazzsingh

Rank: Member

Joined: 10/28/2003(UTC)
Posts: 168

Everything was working fine ....

but sudently i have started seeing delay in loading of home page.

In logs i see:

procedure: bvc_Order_d line: 25 Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Exception: System.Data.SqlClient.SqlException: procedure: bvc_Order_d line: 25 Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at BVSoftware.Bvc5.Core.Datalayer.SqlDataHelper.ExecuteNonQuery(DataRequest request)
Jazz Singh
SEO, Ecommerce, BVSoftware Development, Database Development, SQL Scripts,

www.DesignMarketSEO.com

www.sequent-tech.com
Aaron
#2 Posted : Monday, February 2, 2009 11:00:16 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Jazz,

It sounds like you may be having concurrency problems since these queries are probably on the slow side. One thing you could try is to add the WITH (NOLOCK) hint to the bvc_Product_ProductsOrderedCount_s procedure. That should prevent the procedure from locking the table during the lookup.

If that doesn't help maybe it's related to the cart cleanup process. How often does it run and does the timing match up to your errors?
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Jazzsingh
#3 Posted : Monday, February 2, 2009 3:38:31 PM(UTC)
Jazzsingh

Rank: Member

Joined: 10/28/2003(UTC)
Posts: 168

I have narrowed it down to Top10 products widget.
If I remove everything works fine.

also seeing:


Cannot find table 0.[ at System.Data.DataTableCollection.get_Item(Int32 index) at BVSoftware.Bvc5.Core.Catalog.InternalProduct.Mapper.FindTotalProductsOrdered(DateTime startDate, DateTime endDate) at BVSoftware.Bvc5.Core.Catalog.InternalProduct.FindTotalProductsOrdered(DateTime startDate, DateTime endDate) at BVModules_ContentBlocks_Top_10_Products_view.LoadProducts() in D:\Inetpub\wwwroot\domains\officialticketcenter\BVModules\ContentBlocks\Top 10 Products\view.ascx.vb:line 16 at BVModules_ContentBlocks_Top_10_Products_view.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\domains\officialticketcenter\BVModules\ContentBlocks\Top 10 Products\view.ascx.vb:line 9 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ]


procedure: bvc_Order_ByCriteria_s line: 31 Transaction (Process ID 61) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Exception: System.Data.SqlClient.SqlException: procedure: bvc_Order_ByCriteria_s line: 31 Transaction (Process ID 61) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at System.Data.SqlClient.SqlDataReader.NextResult() at System.Data.ProviderBase.DataReaderContainer.NextResult() at System.Data.Common.DataAdapter.FillNextResult(DataReaderContainer dataReader) at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at BVSoftware.Bvc5.Core.Datalayer.SqlDataHelper.ExecuteDataSet(DataRequest request, Int32 startRowIndex, Int32 maximumRows, Int32& rowCount)
Jazz Singh
SEO, Ecommerce, BVSoftware Development, Database Development, SQL Scripts,

www.DesignMarketSEO.com

www.sequent-tech.com
Aaron
#4 Posted : Monday, February 2, 2009 4:00:43 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Which error are you seeing more? Also, did you try my suggestion?
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Jazzsingh
#5 Posted : Tuesday, February 3, 2009 3:40:34 PM(UTC)
Jazzsingh

Rank: Member

Joined: 10/28/2003(UTC)
Posts: 168

yes. i didnt see deadlocks so far but i only turned it on for short while as the delay is huge.

Default parameters for sp are

bvc_Product_ProductsOrderedCount_s procedure '1900-01-01 00:00:00.000' and '3000-12-31 00:00:00.000'

this query in Profiler shows that it takes average of 5-6 seconds alone causing delay on page load.

I am considering making it

bvc_Product_ProductsOrderedCount_s procedure getdate() -100 getdate()
Jazz Singh
SEO, Ecommerce, BVSoftware Development, Database Development, SQL Scripts,

www.DesignMarketSEO.com

www.sequent-tech.com
Aaron
#6 Posted : Tuesday, February 3, 2009 5:44:28 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Yeah, I saw that query and wondered how it would perform. We've done similar things in the past to optimize these kind of queries. Another simple thing you could do is to use the ASP.NET output caching on the control. There's really no reason not to cache this kind of data.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Jazzsingh
#7 Posted : Friday, February 6, 2009 6:39:08 PM(UTC)
Jazzsingh

Rank: Member

Joined: 10/28/2003(UTC)
Posts: 168

This is what i have done.


Create a new table to store top 10 products.

Create a new Store Procedure to populate above

Update existing Store Procedure to select records instead of query from above table

Create a nightly job to execute sp to populate table with top 10 products.




GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[bvc_TopTenProducts](
[bvin] [varchar](36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ProductName] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Total Ordered] [decimal](38, 10) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


create procedure bvc_PopulateTopTenProducts as
begin
truncate table bvc_TopTenProducts;
insert into bvc_TopTenProducts
SELECT TOP 10
p.bvin,
p.ProductName,
SUM(l.Quantity) AS "Total Ordered"
FROM
bvc_LineItem l
JOIN bvc_Product p ON l.productID = p.bvin
JOIN bvc_Order ord ON ord.bvin = l.OrderBvin
WHERE
IsPlaced = 1
AND dbo.bvc_ProductAvailableAndActive(ProductID, 0) = 1
GROUP BY p.bvin, p.ProductName
ORDER BY SUM(l.Quantity) DESC;
end;
go

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[bvc_Product_ProductsOrderedCount_s]

@StartDate datetime = NULL,
@EndDate datetime = NULL,
@MaxRows bigint = 1000
AS
BEGIN TRY
select * from bvc_TopTenProducts
RETURN
END TRY
BEGIN CATCH
EXEC bvc_EventLog_SQL_i
END CATCH
go
Jazz Singh
SEO, Ecommerce, BVSoftware Development, Database Development, SQL Scripts,

www.DesignMarketSEO.com

www.sequent-tech.com
Marcus
#8 Posted : Friday, February 6, 2009 6:57:18 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Nice solution Jazz. I'll certainly look into something similar while optimizing this in a future update.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012