Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
20 stars 16 forks source link

Optimizely CMS times out after a deployment due to a query #121

Closed so-huz closed 1 month ago

so-huz commented 6 months ago

CMS site with cms12 , .Net 8 and Notfoundhandler version 5.0.8 is getting timed out due to a query that is consuming the sql sever at 100%.

(@contentKey nvarchar(2000))SELECT TOP 1 Id, ContentKey, Urls, CreatedUtc 
                                FROM [dbo].[NotFoundHandler.ContentUrlHistory] 
                                WHERE ContentKey = @contentKey 
                                ORDER BY CreatedUtc DESC

And also we noticed that 3000+ records are getting added to the table ContentUrlHistory each day. Is this normal ? Can we clean the table ? Anyone else facing similar issue ?

The table currently has 500,000 + records.

pmatocha commented 6 months ago

We are experiencing the same issue on our testing enviroment. cms12.2, .Net 6.0 and Notfoundhandler version 5.0.8

Our table has 1592718 records. And it keeps getting bigger and bigger.

Is it possible to add some maintance or index, for example add OnDeletedContent event to remove records?

so-huz commented 6 months ago

@pmatocha Perhaps a job that modifies content could be adding unwanted records to this table. We asked support to delete such records (around 500,000) and the time out issue went away.

But the underlying issue is still there and the table keeps growing back.

jevgenijsp commented 1 month ago

Issue resolved by adding index in ContentUrlHistory table in the latest release https://github.com/Geta/geta-notfoundhandler/releases/tag/v5.0.9