I am looking to track the memory consumption of our application / web page over fixed intervals on different clients. My team would like to observe this metric in understanding if any new feature roll outs have significant impact to the memory consumed by the app and rollback the feature if it does so.
I've read up on these sources:
- https://web.dev/monitor-total-page-memory-usage/
- https://trackjs.com/blog/monitoring-javascript-memory/
- https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
- https://wicg.github.io/performance-measure-memory/
- https://github.com/WICG/performance-measure-memory
First, if we look at the old API: window.performance
The user must enable accurate memory monitoring by starting Chrome with the "--enable-precise-memory-info" flag. To me, it doesn't seem reasonable to expect our users to run Chrome with this flag.
I also read that this API could over or under measure the memory consumption because it measures the size of the JavaScript Heap which could be incorrect if there are iframes or service workers which start a different heap or if there are any large web pages that are on the same heap.
Because of these two reasons, this option is not a valid option (imo) for the goal of frontend observability on real clients in production.
Second, if we look at the new API: performance.measureMemory().
It is only available via an origin trial till Jan, 2021 (as per what the form told me when I signed up for a token).
Beyond local profiling on dev machines, this seems to be the only alternative at the moment to achieve what I'm looking to achieve above (or am I mistaken in my assumption?).
I have two questions regarding the usage of the API:
- Do we have any alternatives after Jan 2021 (would this not be available after Jan)?
- I can test this on my local by enabling the flag:
#enable-experimental-web-platform-featureswithout any issues. I have an origin trial token and if I add this as a meta tag to myindex.html, do my users need any flags enabled on their browser in order for us to observe this?