System.InvalidOperationException after about 24 hours of using orchard in test environment

Topics: General, Troubleshooting, Writing themes
Nov 18, 2011 at 4:18 PM

We have experienced this problem several times over the last three days, but only in our test environment not in our development environment. The application appears to run for about 24 hours then something happens that kills the database (a database restore solves the problem). I am at a bit of a loss as to how to debug this issue and appears to be persistant.

System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:

~/Themes/SafeMode/Views/HomePage/Home/Index.ascx

~/Themes/SafeMode/Views/HomePage/Home/Index.asp

.

.

.

 

Stack trace

at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter\ filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext\ controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,\ String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult\ result) in C:\Project\orchard-rtm\src\Orchard\Mvc\Routes\ShellRoute.cs:line\ 148
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nov 18, 2011 at 4:42 PM

The following is logged in the error and debug logs:

 

2011-11-18 16:40:29,627 [9] Orchard.ContentManagement.DefaultContentManager - ApplicationException thrown from IContentHandler by Orchard.Core.Routable.Handlers.RoutePartHandlerBase
System.ApplicationException: Invalid home page setting value for RoutableHomePageProvider:
   at Orchard.Core.Routable.Services.RoutableHomePageProvider.GetHomePageId(String value) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Services\RoutableHomePageProvider.cs:line 39
   at Orchard.Core.Routable.Handlers.RoutePartHandlerBase.GetContentItemMetadata(GetContentItemMetadataContext context) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Handlers\RoutePartHandler.cs:line 147
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass5c.<GetItemMetadata>b__5b(IContentHandler handler) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Project\orchard-rtm\src\Orchard\InvokeExtensions.cs:line 19
2011-11-18 16:40:29,701 [9] Orchard.ContentManagement.DefaultContentManager - ApplicationException thrown from IContentHandler by Orchard.Core.Routable.Handlers.RoutePartHandlerBase
System.ApplicationException: Invalid home page setting value for RoutableHomePageProvider:
   at Orchard.Core.Routable.Services.RoutableHomePageProvider.GetHomePageId(String value) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Services\RoutableHomePageProvider.cs:line 39
   at Orchard.Core.Routable.Handlers.RoutePartHandlerBase.GetContentItemMetadata(GetContentItemMetadataContext context) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Handlers\RoutePartHandler.cs:line 147
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass5c.<GetItemMetadata>b__5b(IContentHandler handler) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Project\orchard-rtm\src\Orchard\InvokeExtensions.cs:line 19
2011-11-18 16:40:29,701 [9] Orchard.ContentManagement.DefaultContentManager - ApplicationException thrown from IContentHandler by Orchard.Blogs.Handlers.BlogPartHandler
System.ApplicationException: Invalid home page setting value for RoutableHomePageProvider:
   at Orchard.Core.Routable.Services.RoutableHomePageProvider.GetHomePageId(String value) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Services\RoutableHomePageProvider.cs:line 39
   at Orchard.Blogs.Handlers.BlogPartHandler.GetItemMetadata(GetContentItemMetadataContext context)
   at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.GetContentItemMetadata(GetContentItemMetadataContext context) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 305
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass5c.<GetItemMetadata>b__5b(IContentHandler handler) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Project\orchard-rtm\src\Orchard\InvokeExtensions.cs:line 19
2011-11-18 16:40:29,709 [9] Orchard.ContentManagement.DefaultContentManager - ApplicationException thrown from IContentHandler by Orchard.Core.Routable.Handlers.RoutePartHandlerBase
System.ApplicationException: Invalid home page setting value for RoutableHomePageProvider:
   at Orchard.Core.Routable.Services.RoutableHomePageProvider.GetHomePageId(String value) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Services\RoutableHomePageProvider.cs:line 39
   at Orchard.Core.Routable.Handlers.RoutePartHandlerBase.GetContentItemMetadata(GetContentItemMetadataContext context) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Handlers\RoutePartHandler.cs:line 147
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass5c.<GetItemMetadata>b__5b(IContentHandler handler) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Project\orchard-rtm\src\Orchard\InvokeExtensions.cs:line 19
2011-11-18 16:40:29,710 [9] Orchard.ContentManagement.DefaultContentManager - ApplicationException thrown from IContentHandler by Orchard.Blogs.Handlers.BlogPartHandler
System.ApplicationException: Invalid home page setting value for RoutableHomePageProvider:
   at Orchard.Core.Routable.Services.RoutableHomePageProvider.GetHomePageId(String value) in C:\Project\orchard-rtm\src\Orchard.Web\Core\Routable\Services\RoutableHomePageProvider.cs:line 39
   at Orchard.Blogs.Handlers.BlogPartHandler.GetItemMetadata(GetContentItemMetadataContext context)
   at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.GetContentItemMetadata(GetContentItemMetadataContext context) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 305
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass5c.<GetItemMetadata>b__5b(IContentHandler handler) in C:\Project\orchard-rtm\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Project\orchard-rtm\src\Orchard\InvokeExtensions.cs:line 19

Nov 18, 2011 at 5:03 PM

When this happens, what is the value of the HomePage column in Settings_SiteSettingsPartRecord?

Also, what version of Orchard are you using, and what non-core modules do you have installed?

Nov 18, 2011 at 5:42 PM

Hi Pete,

HomePage = RoutableHomePageProvider;8

I have a number of custom created modules, Contrib.Taxonomies, Contrib.ImageField, Advanced Menu and Vandelay.Industries.

Thanks,

Richard

Nov 18, 2011 at 5:45 PM

Although Weirdly:

_workContextAccessor.GetContext().CurrentSite
{Orchard.Core.Settings.Models.SiteSettingsPart}
    [Orchard.Core.Settings.Models.SiteSettingsPart]: {Orchard.Core.Settings.Models.SiteSettingsPart}
    BaseUrl: null
    HomePage: null
    PageSize: 10
    PageTitleSeparator: " - "
    ResourceDebugMode: FromAppSetting
    SiteCulture: null
    SiteName: "My Orchard Project Application"
    SiteSalt: "3562bdaecd9d4843b32f5ebe9d779d78"
    SuperUser: null

Nov 18, 2011 at 7:21 PM

In the table Orchard_Framework_ContentItemRecord, how many entries do you have with ContentType_id == 1? They represent the site object and there should be only one (I'm wondering if somehow you ended up with a second one)

Nov 21, 2011 at 3:51 PM
Edited Nov 21, 2011 at 3:52 PM

Hi Pete,

Thats curious:

SELECT TOP 1000 [Id]
      ,[Data]
      ,[ContentType_id]
  FROM [Editorial_RC3].[dbo].[Orchard_Framework_ContentItemRecord]
  WHERE [ContentType_id] = 1

Id    Data    ContentType_id
1    <Data />    1
253736    NULL    1
253737    NULL    1
253738    NULL    1
253739    NULL    1

In addition:

SELECT     TOP (200) Id, SiteSalt, SiteName, SuperUser, PageTitleSeparator, HomePage, SiteCulture, ResourceDebugMode, PageSize
FROM         Settings_SiteSettingsPartRecord

1 1dc9da850787407bafb7007c7764040e RTM Editorial admin - RoutableHomePageProvider;8 en-US Disabled 10
253736 e521d3c59db944fe8fc28c4de6c935c8 My Orchard Project Application NULL - NULL NULL FromAppSetting 10
253737 fd9c159c2f4f4c0fa9e1a89ffa7735fc My Orchard Project Application NULL - NULL NULL FromAppSetting 10
253738 c099c2f667ed41d28ca20f8f2356a889 My Orchard Project Application NULL - NULL NULL FromAppSetting 10
253739 c9488f7eb4cd4ff9b8ebe89e7364d458 My Orchard Project Application NULL - NULL NULL FromAppSetting 10
NULL NULL NULL NULL NULL NULL NULL NULL NULL

Question is to clean this up, best to delete the extra instances from Orchard_Framework_ContentItemRecord and Settings_SiteSettingsPartRecord? Next question would be why is this happeneing and how to avoid it.

Nov 21, 2011 at 4:06 PM

Yep, delete those extra insteances (there could also be other records joined to those content ids but it shouldn't matter once the ContentItemRecord is gone).

I've no idea how things could have got like this, although there could be some clues further back in your logs.

Hopefully it was a one-off (it looks like those all got created at the same time due to the consecutive ids). But if it starts happening again it really needs investigating.

Nov 21, 2011 at 4:18 PM
Edited Nov 21, 2011 at 4:19 PM

I can reproduce the issue just by running stress testing against the site, it appears to happen at about 20 concurrent, an extra record appears on the first request after the application pool is restarted.

Deleting the extra records has no effect:

SELECT * FROM [Editorial_RC3].[dbo].[Settings_SiteSettings2PartRecord] WHERE Id != 1
SELECT * FROM [Editorial_RC3].[dbo].[Settings_SiteSettingsPartRecord] WHERE Id != 1
SELECT * FROM [Editorial_RC3].[dbo].[Orchard_Framework_ContentItemRecord] WHERE ContentType_id = 1 AND Id != 1
SELECT * FROM [Editorial_RC3].[dbo].[Orchard_Framework_ContentItemVersionRecord] WHERE ContentItemRecord_id IN (SELECT Id FROM [Editorial_RC3].[dbo].[Orchard_Framework_ContentItemRecord] WHERE ContentType_id = 1)

Searching for "My Orchard Project Application" I get the following on line 28 of SiteService.cs:

 

  C:\Project\orchard-rtm\src\Orchard.Web\Core\Settings\Services\SiteService.cs(37):

        public ISite GetSiteSettings() {
            var siteId = _cacheManager.Get("SiteId", ctx => {
                var site = _contentManager.Query("Site")
                    .Slice(0, 1)
                    .FirstOrDefault();

                if (site == null) {
                    site = _contentManager.Create<SiteSettingsPart>("Site", item => {
                        item.Record.SiteSalt = Guid.NewGuid().ToString("N");
                        item.Record.SiteName = "My Orchard Project Application";
                        item.Record.PageTitleSeparator = " - ";
                    }).ContentItem;
                }

                return site.Id;
            });

            return _contentManager.Get<ISite>(siteId);
        }

 

I assume this has been added in as a test seam?

Nov 21, 2011 at 4:26 PM
Edited Nov 21, 2011 at 4:27 PM
RichardSlater wrote:

I can reproduce the issue just by running stress testing against the site, it appears to happen at about 20 concurrent, an extra record appears on the first request after the application pool is restarted.

 

Are you saying that 20 concurrent requests causes your app pool to restart? Sounds like a major issue in itself.

The code you've shown could well be how the Site object normally gets created when Orchard is first installed, it just usually also gets other values populated. Perhaps that bit of code itself needs reviewing, however.

The question is, why is that Site query returning null under load? What are you using - SQL CE or Sql Server?

Nov 21, 2011 at 4:32 PM

The app pool is not restarting automatically at all, the memory usage hovers round 1.7GB with CPU peaking at 87% under load.

Environment is as follows:

 - Web Front End running Orchard and 1 other Web Application 2CPU 4GB RAM

 - SQL Server Standard backing the above two Web Applications 2CPU 4GB RAM

 - Orchard Installed with a handfull of custom modules and some third party modules, running 6 blogs the largest blog has 1000 posts with about 3000 posts in total

Nov 21, 2011 at 4:34 PM

So what did you mean by "after the application pool is restarted"? Can you just explain your stress test and the results in more detail?

Nov 21, 2011 at 4:44 PM

Stress testing using BrowserMob adding 1 concurrent user per minute for the first 15 minutes then running with 15 users for a further 15 minute, finally a 15 minute ramp up to 25 concurrent users followed by 15 minutes of 25 concurrent users. The errors appear to start occuring arround the 20 concurrent users part. The test is hitting the following pages in turn:

1) Site Home Page http://rc3.editorial.rtm.makemedia-test.com/

2) Custom Blogs Home Page http://rc3.editorial.rtm.makemedia-test.com/news-and-blogs/

3) Blog Home Page http://rc3.editorial.rtm.makemedia-test.com/big-lorry-blog/

4) Blog Post http://rc3.editorial.rtm.makemedia-test.com/big-lorry-blog/mack-and-pete-meet-at-daybreak

Once the error is first seen it is seen on every request from there on in, if you restart the AppPool during the test the first request generates an extra ContentItem as above and loads the page as expected, all future requests fail with the InvalidOperationException message.

Hope that makse sense.

Nov 21, 2011 at 5:18 PM

I see, so you're not actually hitting any errors at all until you restart the AppPool?

The reason subsequent requests fail is because the SiteId is cached after the first request, but of course it's getting cached to the value of the invalid Site object which has just been created.

For whatever reason, the scenario is causing the Site query to return null. Possibly this could be a database locking issue? Really we need Orchard devs to advise on this. What Orchard version is this on?

Nov 21, 2011 at 5:28 PM
Edited Nov 21, 2011 at 5:29 PM

Errors occur about 35 minutes into the test run without restarting the AppPool. The AppPool comment was an observation of what happens upon restarting the AppPool in case it is relevant, it has no real relation to the problem at hand.

Running Orchard 1.3 with a couple of tweaks sent through by Sebastien to aid performance.

Rich

Nov 21, 2011 at 5:47 PM

Restarting the AppPool is definitely relevant, I guess stuff is going on during Orchard startup that then for some reason causes the Site to appear null so a new one gets created.

What tweaks did Sebastien send, did any of them have to do with the database layer, perhaps NHibernate caching or anything like that?

Nov 21, 2011 at 9:41 PM

Performance improvement tweaks related to the number of comments we have in our blogs (nearly 10,000) the change was in the view from the Dashboard. We also added some indices on varous tables related to content items as there were areas where query performance was sub-optimal due to a lack of indexing.

Sebastien has asked me to make a change from ReadCommitted to ReadUncommitted and I am in the process of re-running the tests, it looks much more promising at the present. I shall try and remember to check back in with my results tomorrow morning.

Nov 22, 2011 at 1:06 PM

The tests I ran last night worked fine even at 25 concurrent users, however in running the tests again this morning the above errors recurred.

I am going to start disabling modules to try and eleminate any of our code from the equation.

@randompete - if I was to provide you with access to our bitbucket repository would you be willing to take a glance at our code to see if anything jumps out at you? could you get in contact with me richard.slater AT makemedia.com?

Nov 23, 2011 at 12:11 PM

I have the same issues. Firs I found extra recods, on Orchard_Framework_ContentItemRecord , Settings_SiteSettingsPartRecord and the related others. I delete them , but I received the same error. I start debuging and indeed a new site was created all the time (the Settings_SiteSettingsPartRecord was locked when i was in debug, maybe someoan can point to a solution to set issolation level when in debug). The problem in my case seems to be this query:

SELECT this_.Id as Id73_2_, this_.Number as Number73_2_, this_.Published as Published73_2_, this_.Latest as Latest73_2_, this_.Data as Data73_2_, this_.ContentItemRecord_id as ContentI6_73_2_, contentite1_.Id as Id69_0_, contentite1_.Data as Data69_0_, contentite1_.ContentType_id as ContentT3_69_0_, contenttyp2_.Id as Id72_1_, contenttyp2_.Name as Name72_1_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_  on this_.ContentItemRecord_id=contentite1_.Id inner join Orchard_Framework_ContentTypeRecord contenttyp2_  on contentite1_.ContentType_id=contenttyp2_.Id WHERE contenttyp2_.Name in ('Site') and this_.Published = 1

the inner join was excluding the site because of this entry in Orchard_Framework_ContentItemVersionRecord table:

Id Number Published Latest             Data             ContentItemRecord_id

1    1              1             1                     NULL            NULL

As soon as I updated the ContentItemRecord_id to point to the corect ItemRecord (id 1 in my case) the site starts well.

I end up with this error in a various ways. Some times when I do configurations on my test machine (so no multiuser stress) and now, when I try to enable Advanced Menu 1.3.0 (after I disabled ofc_) on Orchard 1.1.30. After I updated  ContentItemRecord_id as I point above and the site starts, I try to enable again Advanced Menu ended to the same error. This time the effect was more severe, by updating to null more rows in Orchard_Framework_ContentItemVersionRecord table , including first rows for the site item.

Maybe all this informations can help a more advanced Orcard user.

Jan 5, 2012 at 12:02 PM

FILIP07, do you have the Database Caching module enabled? Disabling this seems to have sorted out the issues.

Sorry for not posting sooner Sebastien and I took this conversation offline, and I forgot to subscribe to replies to this thread.

Jan 6, 2012 at 8:21 AM

Hi Richard

Yes, I have Database Caching module enabled. Can you run your site on live environment without Database Caching module enabled ?

Coordinator
Jan 6, 2012 at 8:43 AM

Of course you can. Database caching actually does not work that well. I recommend you use the output caching from Contrib.Caching instead.

Jan 6, 2012 at 9:05 AM

I inted to use Orchard on a site with over 1.500.000 displayed pages on a month. You suggest  an ASP.NET based cache, but this is not the best scenario for very dynamic pages ( i have, user specific content ), so I need to find a way to decrease the database access.

Coordinator
Jan 6, 2012 at 9:09 AM

Well, output caching decreases database access. In any case, the database cache module doesn't work well. You can do some custom caching in your own modules if necessary. There are many approaches you can take. Can you tell us more about the contents of the site, how it's structured, that sort of thing? If you think stuff can be cached, it's not that dynamic. what is the proper level where caching is appropriate in your opinion for that particular application?

Jan 6, 2012 at 10:31 AM

I'm concerned about many data access from orchard framework. I can make my own cache mechanism in my modules, but for the rest I will like to can make at least stored procedures instead of using generated sql query.

I want to mix in a page standard orchard modules with my custom modules, but i noticed an average of 50 database access for a page with a single blog post, without enabling database caching and on 4th and more subsequent reload.

Any way, I suspect not an exclusive database caching fault, because I found new extra recods, on Orchard_Framework_ContentItemRecord , Settings_SiteSettingsPartRecord and the related others tables.

Regarding your question, What is the proper level where caching is appropriate in your opinion for that particular application? , I will like to have the ms sql dedicated stored procedures for Orchard framework, (I know nhibernate have this feature, but not as it is implemented now in Orchard). Second I think that a working Databse Caching will be the best candidate.

Coordinator
Jan 6, 2012 at 5:07 PM

You should try the latest in the 1.x branch, you'll see a lot less queries.

As for the thing about stored procedures, I'm pretty sure that won't work. Or that it wouldn't help if it did. Which it won't.

You did not answer my question about the structure of the site and how it's going to be hit. Caching efficiency depends on the type of site you're building. We need specific information here.

Coordinator
Jan 6, 2012 at 5:37 PM

If you are doing a website using a CMS, you can hardly get stunning performance out of the box without using some caching in place. And all CMS have to be chatty with the db, by design.

The best approach is to use Output Caching in my opinion. You can try with the Caching module from the gallery, and you will get really good results. As Bertrand said the current version in development will also improve things a lot.

I can tell you that going to stored procs won't help at all, and will take you a lot of time and effort. Also you won't be able to handle parts in the system where queries are created dynamically based on configuration and metadata.

Jan 7, 2012 at 2:59 PM

I can only talk about my expereiences of building out commercialmotor.com recently, in comparison the total unique page views is of the same order of magnitude as 1.5M Page Views per month in your example. We had a few weeks where we thought the performance was going to be a big problem however there were three factors to bringing this under control:

1) Output Caching Module / Warmup - the majority of our pages are static so these two modules allowed us to reduce both database load and cold startup times on the most commonly hit pages.

2) Careful Database Optimization - using New Relic ( http://newrelic.com/ ) to profile the database and web application and BrowserMob ( https://browsermob.com/performance-testing ) to simulate load we were able to identfy the slowest performing queries. We could then remove these bottlenecks by either adding specific indicies to affected tables or rewriting the NHibernate queries in modules were were using.

3) Two tier server architecture - the needs of a database server are different from those of a web server, by having a web front end running Orchard and a Database Server running SQL Server we were able to optimize the environments for each role without comprimising either.

I will gladly go into the specifics by e-mail, IRC, IM, etc. I am somewhat wary however of posting up exactly what we changed as each use case for Orchard will be different and YMMV. Rest assured however, I don't believe that there is anything that would prevent you getting your site up and running stabily using Orchard.

Regards,

Richard

Feb 6, 2012 at 2:14 PM

I just got this on our Staging site when disabling a module. (Combinator)

 

Now the database is corrupt, trying to repair it now.

Feb 6, 2012 at 2:22 PM
Sarkie wrote:

I just got this on our Staging site when disabling a module. (Combinator)

 

Now the database is corrupt, trying to repair it now.

Can you post an excerpt from your debug and error logs (App_Data/logs)? 

Feb 6, 2012 at 2:31 PM

Well every Settings table has a new id in it for a site

2420.

I just noticed that someone has installed the DBCache Module. I'm going to guess that's the issue since its very much in beta! 

This is one from Event Viewer

 


Exception information:     Exception type: NullReferenceException     Exception message: Object reference not set to an instance of an object.   at Orchard.Localization.Services.SiteCultureSelector.GetCulture(HttpContextBase context) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\SiteCultureSelector.cs:line 13   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)   at Orchard.Localization.Services.DefaultCultureManager.GetCurrentCulture(HttpContextBase requestContext) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\DefaultCultureManager.cs:line 58   at Orchard.Localization.Services.CurrentCultureWorkContext.<Get>b__0[T](WorkContext ctx) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\CurrentCultureWorkContext.cs:line 13   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7`1.<FindResolverForState>b__5() in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 37   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 28   at Orchard.Localization.Text.Get(String textHint, Object[] args) in d:\Builds\OrchardFull\src\Orchard\Localization\Text.cs:line 27   at Orchard.Users.Security.FrontEndFilter.OnAuthorization(AuthorizationContext filterContext) in d:\octopus\Tentacle\Applications\684.0\Modules\Orchard.Users\Security\AccessFrontEndFilter.cs:line 26   at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)   at System.Web.Mvc.Controller.ExecuteCore()   at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()   at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\Builds\OrchardFull\src\Orchard\Mvc\Routes\ShellRoute.cs:line 148   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

App Logs

There is a background task running

 

2012-02-06 13:30:52,328 [14] Orchard.Tasks.BackgroundService - Error while processing background taskSystem.NullReferenceException: Object reference not set to an instance of an object.   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in d:\Builds\OrchardFull\src\Orchard\ContentManagement\DefaultContentManager.cs:line 149   at Orchard.ContentManagement.ContentGetExtensions.Get[T](IContentManager manager, Int32 id) in d:\Builds\OrchardFull\src\Orchard\ContentManagement\ContentExtensions.cs:line 146   at Orchard.Settings.CurrentSiteWorkContext.Get[T](String name) in d:\Builds\OrchardFull\src\Orchard\Settings\CurrentSiteWorkContext.cs:line 13   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)   at Orchard.Environment.WorkContextImplementation.FindResolverForState[T](String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 32   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 27   at Orchard.Seo.BackgroundTasks.SiteMapGeneratorTask.Sweep() in d:\octopus\Tentacle\Applications\684.0\Modules\Orchard.Seo\BackgroundTasks\SiteMapGeneratorTask.cs:line 58   at Orchard.Tasks.BackgroundService.Sweep() in d:\Builds\OrchardFull\src\Orchard\Tasks\BackgroundService.cs:line 31

2012-02-06 13:30:52,547 [14] Orchard.Errors.Filters.LoggingHandleErrorAttribute - An unhandled exception was thrown for /images/pubs/s4086/searchresult.jpgSystem.NullReferenceException: Object reference not set to an instance of an object.   at Orchard.Localization.Services.SiteCultureSelector.GetCulture(HttpContextBase context) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\SiteCultureSelector.cs:line 13   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)   at Orchard.Localization.Services.DefaultCultureManager.GetCurrentCulture(HttpContextBase requestContext) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\DefaultCultureManager.cs:line 58   at Orchard.Localization.Services.CurrentCultureWorkContext.<Get>b__0[T](WorkContext ctx) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\CurrentCultureWorkContext.cs:line 13   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7`1.<FindResolverForState>b__5() in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 37   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:line 28   at Orchard.Localization.Text.Get(String textHint, Object[] args) in d:\Builds\OrchardFull\src\Orchard\Localization\Text.cs:line 27   at Orchard.Users.Security.FrontEndFilter.OnAuthorization(AuthorizationContext filterContext) in d:\octopus\Tentacle\Applications\684.0\Modules\Orchard.Users\Security\AccessFrontEndFilter.cs:line 26   at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

 

 

 

 

 

Feb 6, 2012 at 3:12 PM

So I fixed it in the database for anyone.

update Orchard_Framework_ContentItemVersionRecord set ContentItemRecord_id=1where id=1

It was set to null.

I also deleted references to the "other" site, not sure if that was correct. The site is working now though.

There was another site that was created, so in all the settings etc its got another site, I assume it think it's another tenant?