NetCore Reports Caching and load balancers
Posted: Wed Sep 18, 2019 8:17 pm
Hello,
It seems as though using StiServerCacheMode.None causes reports to go into an infinite loop loading again and again. Our applications are deployed on a load balancer across two servers. Each alternating request is routed to the other server and vice versa. So the default cache mode causes the report to be cached on the alternate server every time. So whenever I try to do a drill-down from a dashboard chart, it just reloads because it can't find the cached report... because it's on the other server. So it never actually drills down. If I take down one of the servers on the load balancer, everything works because it is all coming from one server.
I attempted to disable caching using the StiNetCoreViewerOptions() Server.CacheMode = StiServerCacheMode.None. However, this causes the initial dashboard page to continuously reload in an infinite loop. Almost as if it retrieves the report, doesn't load it into the cache, but then it tries to retrieve it from the cache, which isn't there, so it fetches the report again.
This is very easy to reproduce using the Stimulsoft DashboardSalesByMonth demo (https://demo.stimulsoft.com/#Net/DashboardSalesByMonth). I published this report without modifying anything from the Designer using the .NET Core and Angular configuration.
Then, in the ViewerController.cs, I disabled caching in the /api/viewer Get() method like this:
Then run the application in IIS Express and navigate to the dashboard page from the side menu. The report will load over and over in an infinite loop. Is there an additional setting I need to set if I disable cache mode? Or how can I make it use something like browser cache instead of server cache?
Thanks!
-Emanuel
It seems as though using StiServerCacheMode.None causes reports to go into an infinite loop loading again and again. Our applications are deployed on a load balancer across two servers. Each alternating request is routed to the other server and vice versa. So the default cache mode causes the report to be cached on the alternate server every time. So whenever I try to do a drill-down from a dashboard chart, it just reloads because it can't find the cached report... because it's on the other server. So it never actually drills down. If I take down one of the servers on the load balancer, everything works because it is all coming from one server.
I attempted to disable caching using the StiNetCoreViewerOptions() Server.CacheMode = StiServerCacheMode.None. However, this causes the initial dashboard page to continuously reload in an infinite loop. Almost as if it retrieves the report, doesn't load it into the cache, but then it tries to retrieve it from the cache, which isn't there, so it fetches the report again.
This is very easy to reproduce using the Stimulsoft DashboardSalesByMonth demo (https://demo.stimulsoft.com/#Net/DashboardSalesByMonth). I published this report without modifying anything from the Designer using the .NET Core and Angular configuration.
Then, in the ViewerController.cs, I disabled caching in the /api/viewer Get() method like this:
Code: Select all
[HttpGet]
public IActionResult Get()
{
// Setting the required options on the server side
var requestParams = StiNetCoreViewer.GetRequestParams(this);
if (requestParams.Action == StiAction.Undefined)
{
var options = new StiNetCoreViewerOptions()
{
Server =
{
CacheMode = StiServerCacheMode.None //Disable cache
}
};
return StiNetCoreViewer.GetScriptsResult(this, options);
}
return StiNetCoreViewer.ProcessRequestResult(this);
}
Thanks!
-Emanuel