Diagnose slow application startup caused by blocking JavaScript with io.Insights

A web application running in io.Connect Desktop can be slow to open because its own JavaScript is keeping the page busy during startup. With io.Insights, you can inspect the startup trace and distinguish time spent loading resources from time spent executing application code.

This tutorial follows a long page-load handler to an event-loop blocking span that identifies buildSearchIndex, a function running for roughly nine seconds during startup.

Prerequisites

  • An io.Connect Desktop 10.5 or later with io.Insights and trace collection enabled.
  • Software for viewing the captured trace, such as Jaeger or Grafana with a tracing data source configured.
  • This walkthrough assumes you already collect traces. It does not cover deploying a collector or recreating the demo application.

1. Find where startup time is spent

Open the affected application’s startup trace and inspect the sequence from window creation into page loading. Look at resource requests and the page’s event handlers to see where the long operations occur.

In this example, the visible resource spans are short, while navigation.contentLoadedHandlers takes 9.17 seconds. An eventLoopBlocking span covers nearly the same interval and lasts 9.16 seconds.

Startup trace showing short resource loads and overlapping 9.17-second page-handler and 9.16-second event-loop blocking spans.

The two long spans overlap: do not add their durations together. View the full screenshot.

2. Identify the script running during the delay

Select the eventLoopBlocking span and inspect its attributes. The example records:

Attribute Recorded value
scriptFunctionName buildSearchIndex
durationMs 9,164 ms
scriptDurationMs 9,161 ms
blockingDurationMs 9,114 ms
isStartup true
scriptInvoker HTMLDocument.onDOMContentLoaded
scriptSourceURL …/pre-init-test/script.js (demo application)
measurement long-animation-frame

Event-loop blocking span details identifying buildSearchIndex, its script duration and blocking duration during startup.

View the full screenshot.

Here, the long handler and the function details point to application code running during startup, rather than a long resource fetch. The header in the full screenshot shows a 12.0-second trace.

3. Give the application team a concrete operation to investigate

Share the trace, function name, source script and timing with the application team. They need to review the functiont and whether it can be deffered in order to allow users to work during loading.

Watch the example and read more