Clay-less version

Topics: Announcements
Coordinator
Nov 21, 2012 at 12:32 AM
Edited Nov 21, 2012 at 4:48 PM

There is a new temporary branch available named clayless

[EDIT] Removed bad link

It contains a single changeset (easily movable to any custom branch) which will remove Clay from the source. The goal is to use preconfigured dynamic object classes instead of adding dynamic behavior dynamically. The result is much better performance in terms of response time and as a matter of fact requests per seconds. I have also seen better memory consumption results.

You can try it right now on your website as it is available as a changeset over 1.6, so it should be pretty easy to apply.

Goal is to get feedback on perf improvements, bug fixes, and whether it should make it in 1.7.

Developer
Nov 21, 2012 at 12:50 AM
Edited Nov 21, 2012 at 12:50 AM

I love it. Should definitely be in 1.7 . Actually, it should have been there since 0.1 :)

Nov 21, 2012 at 2:56 AM

Awesome! I wasn't aware this was a priority so this is a nice surprise. From profiling my sites I had noticed over half the time was in the rendering and ClaySharp.ClayInterceptor.Intercept alone was contributing 24ms to the response time. Looking forward to integrating these changes and seeing how things compare :)  

Coordinator
Nov 21, 2012 at 3:13 AM

@_tj: this is approximately the gain I measured per request. Would be nice if you could give us some other numbers like memory and cpu.

Nov 21, 2012 at 4:00 AM

Okay once I integrate this change I'll post the difference here. There's only value in looking at the difference as I am quite removed from a standard Orchard install, just using the framework piece for more of an MVC extensibility framework than CMS :)

Should be able to get initial results in a day or two.

As it stands though, for the MVC site with identical functionality as the WebForms we are rewriting, under load the Average CPU % is double what it was. The most intriguing thing in the profiling results however is that about a third of the request time is spent in the ClaySharp namespace... so will be very interesting to see how this changes.

 

Coordinator
Nov 21, 2012 at 5:39 AM

Technically speaking, there is no more ClaySharp namespace ;) so let's say down to zero ...

Nov 21, 2012 at 6:19 AM
Edited Nov 21, 2012 at 6:34 AM

+1... but unable to get it with tortoisehg ...

Nov 21, 2012 at 9:49 AM

+1 I've seen this too while profiling. Nice work!

Nov 21, 2012 at 12:28 PM

Anyone else getting an error while trying to view the link for the changeset? 

Coordinator
Nov 21, 2012 at 4:49 PM

The link doesn't seem to always work, I removed it. FInd the clayless branch by yourself.

Nov 23, 2012 at 11:34 PM

I didn't manage to get the load testing done this week but did implement the change and profile it. The results are very significant, i saw a 70ms drop in response times which halved our overall response time. I'm expecting the high CPU usage to drop off as well. Note again this isn't indicative of the results you will see in standard usage of orchard as we only use the framework. This is really a significant improvement though and should make it in 1.7. 

Nov 24, 2012 at 6:49 AM

i'm measuring locally a  80 - 90 drop in response time. So very nice.

Nov 25, 2012 at 6:18 AM
Edited Nov 25, 2012 at 6:20 AM

i use this version,theme is bootstrap.

when it was  cooking after choosing a recipe, got this error on SearchNav.cshtml of bootstrap theme( both bootstrap reference to Orchard.Search or not)( for 1.6 , the same thing,ok):

 

Server Error in '/OrchardLocal' Application.

Cannot perform runtime binding on a null reference

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference

Source Error: 


Line 2:  
Line 3:  @using (Html.BeginForm("Index", "Search", new { area = "Orchard.Search" }, FormMethod.Get, new { @class = "navbar-form pull-right" })) { 
Line 4:          @Html.TextBox("q", (SearchViewModel)Model.ViewModel.Query, new { @class = "input-medium search-query" })
Line 5:          <button class="btn">@T("Search")</button>
Line 6:  }

Source File: g:\orchard16RealEstate\src\Orchard.Web\Themes\Bootstrap\Views\SearchNav.cshtml    Line: 4 

Stack Trace: 


[RuntimeBinderException: Cannot perform runtime binding on a null reference]
   CallSite.Target(Closure , CallSite , Object ) +80
   System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +432
   ASP._Page_Themes_Bootstrap_Views_SearchNav_cshtml.Execute() in g:\orchard16RealEstate\src\Orchard.Web\Themes\Bootstrap\Views\SearchNav.cshtml:4
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +32
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:134
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.b__15(DisplayContext displayContext) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:118
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.b__2(DisplayContext displayContext) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:80
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:28
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   Orchard.Core.Shapes.CoreShapes.Zone(Object Display, Object Shape, TextWriter Output) in g:\orchard16RealEstate\src\Orchard.Web\Core\Shapes\CoreShapes.cs:251

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:64
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.<>c__DisplayClass4.b__3(DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:55
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.b__2(DisplayContext displayContext) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:80
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:28
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +685
   ASP._Page_Themes_RealEstateBootstrapTheme_Views_Layout_cshtml.b__ad(Object x) in g:\orchard16RealEstate\src\Orchard.Web\Themes\RealEstateBootstrapTheme\Views\Layout.cshtml:28
   CallSite.Target(Closure , CallSite , Func`2 , Object ) +184
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +685
   ASP._Page_Themes_RealEstateBootstrapTheme_Views_Layout_cshtml.Execute() in g:\orchard16RealEstate\src\Orchard.Web\Themes\RealEstateBootstrapTheme\Views\Layout.cshtml:77
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +32
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:134
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.b__15(DisplayContext displayContext) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:118
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.b__2(DisplayContext displayContext) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:80
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in g:\orchard16RealEstate\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:28
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in g:\orchard16RealEstate\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:63
   Orchard.Mvc.ViewEngines.ThemeAwareness.LayoutView.Render(ViewContext viewContext, TextWriter writer) in g:\orchard16RealEstate\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:90
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +295
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1a.b__17() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
   System.Web.Mvc.<>c__DisplayClass1d.b__19() +23
   System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
   System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in g:\orchard16RealEstate\src\Orchard\Mvc\Routes\ShellRoute.cs:162
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Dec 1, 2012 at 12:04 PM

Unfortunately I'm receiving error when I'm trying to create a trigger or action in the rules module. See ticket: http://orchard.codeplex.com/workitem/19316

Dec 20, 2012 at 1:11 PM

Is this going to make it in 1.7? Any chance?

Developer
Dec 24, 2012 at 3:11 PM

Found another issue with the clayless branch when creating a Query with a Content Types filter: http://orchard.codeplex.com/workitem/19373

Developer
Dec 24, 2012 at 3:12 PM
Edited Dec 31, 2012 at 3:55 PM

Update: it's not just with the Content Types filter, it happens on all filters.

Coordinator
Dec 28, 2012 at 7:17 AM

@Cyberdude: definitely.

Dec 28, 2012 at 11:00 AM

Great. Thanks for your hard effort guys.

Feb 15, 2013 at 7:36 AM
Edited Feb 15, 2013 at 7:39 AM
bertrandleroy wrote:
@Cyberdude: definitely.
Bertrand, could you possibly suggest, how can i Find a shape in a clayless version?

I use your shape locating technique in code a lot

Though it requires Clay...

Thank you
Coordinator
Feb 15, 2013 at 7:48 AM
What are you trying to do?
Feb 15, 2013 at 7:57 AM
just preparing myself for the clayless :) Basically i just want to be able to do this:

var model = (Orchard.DisplayManagement.Shapes.Shape)Model;
@Display(ShapeHelper.Find(model, "Parts_Common_Body"))
Coordinator
Feb 16, 2013 at 2:05 AM
Feb 16, 2013 at 7:30 PM
How could I miss this... Thanks again for a great piece of information. It requires some messing with the placement.info, but it does the trick ;)
Coordinator
Feb 18, 2013 at 11:20 PM
I was thinking of implementing an extension method to get a specific shape from a Content. But I realized that it would have to look for all content zones in the case of a Content Item shape, which is related to Placement. So maybe placement is actually the best solution right now.