APM Mobile Inspections upload speed greatly reduced due to unparented assets on assigned indicators


 Product(s):APM Implementation and Performance Management
 Version(s):7
 Environment:N/A
 Area:N/A
 Subarea:N/A

Problem Description

An APM Mobile Inspections user has reported a significant slowdown of APM Mobile Inspections post update to APM Foundation release 7.20 with APM Mobile Inspection release 2.3..

Solution

Upon review the upload speeds had reduced by more than 50% post upgrade. While no single bug was isolated that explained the entire speed hit, a project was launched, VSTS#1058256, to review the general performance of APM Mobile Inspections. 

This project has resulted in 6 main bugs being reported, 1086394, 1099249, 1058960, 1087884, 1099068, 1094484. Fixing these issues will improve performance in future releases. In addition, it was found that several hundred indicators were assigned to assets without a parent in the asset hierarchy. This condition results in Null Reference Exceptions which has a significant impact on performance of device and can even lead to crashing:

Bentley.APM.Rest.Common.UnhandledExceptionAttribute [69] Unhandled exception occurred. EXCEPTION OCCURRED:NullReferenceException Object reference not set to an instance of an object.    at Ivara.ServiceProvider.MobileRestService.Models.v1.Inspections.SliceWrappers.ListWrapper.AssetInlineWrapper.CreateModel()
   at Ivara.ServiceProvider.MobileRestService.Models.Persistent.SliceWrappers.PersistentSliceWrapper`1.<ToEnumerable>d__6.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__64`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Ivara.ServiceProvider.MobileRestService.Models.v1.Inspections.InspectionsModel.GetList[TLw,TRet](Nullable`1 mobilePcGuid)
   at Ivara.ServiceProvider.MobileRestService.Models.v1.Inspections.InspectionsModel.<>c__DisplayClass51_0`7.<GetList>b__1()
   at Ivara.ServiceProvider.MobileRestService.Models.v1.Inspections.InspectionsModel.UnionLists[TRet](List`1 getFunctions)
   at Ivara.ServiceProvider.MobileRestService.Models.v1.Inspections.InspectionsModel.GetAssets(Nullable`1 mobilePcGuid)
   at Ivara.ServiceProvider.MobileRestService.Controllers.BaseController.WrapCall[TRet,TParam](Func`2 modelFunction, TParam parameter)
   at Ivara.ServiceProvider.MobileRestService.Controllers.v1.AssetController.Index(Nullable`1 mobilePcGuid)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()

Repairing this condition by finding all unparented assets in APM foundation and assigning them to the proper parent in the asset hierarchy improved upload speeds by approx 50%. 

See also

SR 7001519597 and SR 7001562850.