Skip to content

Commit dc86f88

Browse files
authored
Overview for React Server Performance tracks (#8031)
1 parent 10e5ad5 commit dc86f88

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
945 KB
Loading
929 KB
Loading

src/content/reference/developer-tooling/react-performance-tracks.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ These tracks are designed to provide developers with comprehensive insights into
3333
React Performance tracks are only available in development and profiling builds of React:
3434

3535
- **Development**: enabled by default.
36-
- **Profiling**: you can either wrap a subtree that you want to instrument with [`<Profiler>`](/reference/react/Profiler) component or have [React Developer Tools extension](/learn/react-developer-tools) enabled.
36+
- **Profiling**: you can either wrap a subtree that you want to instrument with [`<Profiler>`](/reference/react/Profiler) component or have [React Developer Tools extension](/learn/react-developer-tools) enabled. Tracks specific to React Server Components are not enabled in profiling builds.
3737

3838
If enabled, tracks should appear automatically in the traces you record with the Performance panel of browsers that provide [extensibility APIs](https://developer.chrome.com/docs/devtools/performance/extension).
3939

4040
<Pitfall>
4141

4242
The profiling instrumentation that powers React Performance tracks adds some additional overhead, so it is disabled in production builds by default.
43+
Server Components and Server Requests tracks are only available in development builds.
4344

4445
</Pitfall>
4546

@@ -129,3 +130,32 @@ In development builds, when you click on a component render entry, you can inspe
129130
<img className="w-full light-image" src="/images/docs/performance-tracks/changed-props.png" alt="Components track: changed props" />
130131
<img className="w-full dark-image" src="/images/docs/performance-tracks/changed-props.dark.png" alt="Components track: changed props" />
131132
</div>
133+
134+
### Server {/*server*/}
135+
136+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
137+
<img className="w-full light-image" src="/images/docs/performance-tracks/server-overview.png" alt="React Server Performance Tracks" />
138+
<img className="w-full dark-image" src="/images/docs/performance-tracks/server-overview.dark.png" alt="React Server Performance Tracks" />
139+
</div>
140+
141+
#### Server Requests {/*server-requests*/}
142+
143+
The Server Requests track visualized all Promises that eventually end up in a React Server Component. This includes any `async` operations like calling `fetch` or async Node.js file operations.
144+
145+
React will try to combine Promises that are started from inside third-party code into a single span representing the the duration of the entire operation blocking 1st party code.
146+
For example, a third party library method called `getUser` that calls `fetch` internally multiple times will be represented as a single span called `getUser`, instead of showing multiple `fetch` spans.
147+
148+
Clicking on spans will show you a stack trace of where the Promise was created as well as a view of the value that the Promise resolved to, if available.
149+
150+
Rejected Promises are displayed as red with their rejected value.
151+
152+
#### Server Components {/*server-components*/}
153+
154+
The Server Components tracks visualize the durations of React Server Components Promises they awaited. Timings are displayed as a flamegraph, where each entry represents the duration of the corresponding component render and all its descendant children components.
155+
156+
If you await a Promise, React will display duration of that Promise. To see all I/O operations, use the Server Requests track.
157+
158+
Different colors are used to indicate the duration of the component render. The darker the color, the longer the duration.
159+
160+
The Server Components track group will always contain a "Primary" track. If React is able to render Server Components concurrently, it will display addititional "Parallel" tracks.
161+
If more than 8 Server Components are rendered concurrently, React will associate them with the last "Parallel" track instead of adding more tracks.

0 commit comments

Comments
 (0)