How we cut 20M daily API calls & saved $30k a month on our infrastructure
Frikkie dives into how they managed to halve the network traffic from their users by analyzing the lifecycle of React-Native in its handling of background tasks. In this video, he outlines the following:
- The use-case of Apple's Healthkit and its step-counts functionality for Relive.
- Their interface with Healthkit is through a library that they have developed.
- The observation of excessive API calls made while the app is in the background and the user is not actively using it.
- How Apple Healthkit notifies them of new activities and step counts, prompting the app to launch and instantiate the bridge and RCTRootView.
- The mounting of the app's root while it is in the background, is occupied with processing this notification.
- The unavailability of a native solution since the handlers are in the JS layer.
- The introduction of a wrapper that takes into account the app's state before mounting it to resolve this issue.
- The sharing of insights regarding the importance of understanding the React-Native lifecycle.
- The sharing of lessons learned about the significance of investigating unusual events in analytics.