Running Ignition Cloud Edition on AWS with an RDS on the same VPC as history provider.
My power chart defaults to “last 4 hours” and “realtime” when a user opens the powerchart for the first time in perspective. The data for my tags is being logged at 1 second intervals. My refereshRate is set to 1 second and the pointCount is set to 1000.
My users need to be able to see the realtime data when veiwing short time horizons. When they switch measure of time to be something large (i.e. 4 months), it is causing a spike in data because it is querying the raw data before aggregating.
I added a change script to pens that force them into “AggregateMode: MinMax” and an expression binding that changes the mode to “historical” if the measure of time is greater than 3 days. I’m currently testing this approach and while it works in some cases, there seem to be several edge cases where a user can still cause a spike. This also doesn’t seem like the right way to go about it.
I appreciate any guidance you can provide. I feel like this must be a common issue, but I was not able to find anything in the forum or manual.
Four hours is a terrible default timespan for any timeseries chart (or PowerChart), and especially a bad choice for a realtime mode with such a fast refresh. Realtime queries are effectively uncachable, particularly in a PowerChart, due to the lack of control over fine-resolution timestamps (which are millisecond resolution in Ignition).
I strongly recommend a refresh rate no faster than 10 seconds, and span no greater than 10 minutes, for default behavior. Consider limiting the span to no more than an hour or two in realtime mode. I would also require deliberate change to historical mode when exceeding the bounds, and deliberate change back to realtime mode (which restores the default).
It is also unwise to run a database in the same VM as an Ignition Gateway--CPU usage patterns are not compatible.
Thank you @pturmel. I have changed the default behavior to be 10 seconds refresh and 10 minute span per your recommendation. When you say "deliberate” change, do you mean by the user leveraging the built in powerchart features, or using event change scripts that ensure the span and mode are configured correctly?
To safeguard from user error, I’ve implemented a script that resets the window to 10 min with 10s referesh if the user switches mode to realtime, and I have implemented a second script that forces mode to history if the time is beyond 1 hour. Is this consistent with your recommendation?
I mean "deliberate" as "user initiated", whether by PowerChart builtins or by other component bindings/scripts starting with an entry field or button. Your extra scripts sound good.