Detecting a startup performance issue
This tutorial guides you through identifying a performance issue related to your app startup time using the Kotzilla Platform.
Issue context
Startup performance issues occur when the app takes too long to initialize, delaying the appearance of the first usable screen. This issue often arises from heavy operations or blocking tasks running on the main thread during startup.
Why it matters?
- User frustration: Slow startup times can frustrate users, making them more likely to abandon the app.
- App retention: A smoother and faster startup enhances user experience, encouraging users to continue engaging with the app.
- Business impact: An app that starts quickly is more likely to have higher retention rates and lower abandonment rates.
Suggested user resolution actions
- Identify and optimize: Use the Kotzilla Platform to monitor startup tasks, flagging any operation on the main thread that exceeds a 5s threshold.
- Offload heavy tasks: Move resource-intensive operations to background threads or use lazy loading for non-essential features.
- Reduce execution times: Refactor inefficient code and simplify initialization logic to speed up startup.
Prerequisites
In this tutorial, we will be using the NowInAndroid app as an example. Before you begin, ensure you've completed the first two steps of the Get started with Kotzilla Platform
Step 1 - Simulate a slow app startup time
We will introduce a 10 second delay after the Koin setup to simulate a blockage during app initialization, which delays the app’s startup.
Here’s the code to introduce a 10 second delay at the end of the onCreate function:
class NiaApplication : Application(), ImageLoaderFactory {
val imageLoader: ImageLoader by inject()
val profileVerifierLogger: ProfileVerifierLogger by inject()
override fun onCreate() {
super.onCreate()
// Start Kotzilla SDK
KotzillaSDK.setup(this)
// Start Koin with Kotzilla Analytics
startKoin {
androidContext(this@NiaApplication)
analyticsLogger(AndroidLogger(DEBUG))
modules(appModule)
workManagerFactory()
}
Sync.initialize(context = this)
profileVerifierLogger()
// Simulate a slow startup time
Thread.sleep(10000)
}
Step 2- Create user sessions to capture app execution data.
With the simulated delay added, create a user session that will allow the Kotzilla SDK to capture and display the issue.
Run the Now In Android app as described in this guide to simulate a repeatable sequence of interactions. Repeat this three times to create consistent data on Kotzilla Platform.
Step 3- Investigate root cause of issues
With the simulated delay in place, the Kotzilla Platform now automatically detects a startup performance issue in the app as the user experience more than 5s delay before the app loads its first screen. You can quickly view and investigate these issues directly within your IDE using the Koin IDE Plugin.
3.1 View issues in the Koin IDE Plugin
- Open the Issues Panel in the Koin IDE Plugin within your development environment (Android Studio or IntelliJ)
- Click on the Application Issues tab
- You will see an issue labeled
Slow app startup time
.
3.2 Investigating the root cause of issues
To investigate the details of this issue simply click on the
Slow app startup time
issue in the Koin IDE Plugin. This will redirect you to the Issue Details view in the Kotzilla Console.
Here, you will see:
- A list of 3 impacted user sessions.
- A detailed description of the issue. The Startup performance issues occur when the app takes too long to initialize, delaying the appearance of the first usable screen.
3.3 User session analysis to trace the app startup issue
Click on the first impacted user session to drill down into the specific events and components related to the issue. This will take you directly to the Timeline View, where you will observe a 10-second delay between the Koin Modules Load event and the transition to the first screen (MainActivity).
In the Timeline View, you can clearly see how the 10 second delay in the user screen navigation and state insights section. Observe that the app remains in the startup phase for 10 seconds before transitioning to an interactive state.
Key takeaways
By simulating a 10-second delay in NiaApplication, we observed how slow startup initialization postpones the loading of the first usable screen. Using the Koin IDE Plugin and Kotzilla Platform, we identified this issue by analyzing the startup timeline, where the delay occurs between Koin module loading and MainActivity creation. Optimizing app startup processes ensures a faster launch, better responsiveness, and an improved user experience