You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/solution-guidance/portal-performance.md
+38-12Lines changed: 38 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,15 @@ Disable-PnPFeature -Scope Web -Identity 7201D6A4-A5D3-49A1-8C19-19C4BAC6E668 -Fo
114
114
```
115
115
<aname="bk_Telemetry"> </a>
116
116
117
+
### Avoid XSLT based webparts
118
+
119
+
XSLT adds significant cost overhead to the page render. These server controls require that the stylesheet be compiled into runnable code at request time. This can take time to complete, and is server specific. At cloud scales, compilation of custom XSLT can be a frequent event. To avoid these costs, consider using a client rendered control instead. XSLT based webparts include, but are not limited to:
120
+
121
+
- Content Query Webpart
122
+
- XSLT List View Webpart
123
+
- RSS Viewer Webpart
124
+
- DataForm Webpart
125
+
117
126
### Use telemetry
118
127
119
128
Performance is often viewed in subjective terms by end-users. However, it is rather challenging to definitively resolve issues such as *The portal is slow*. To quantify perceived performance issues, it is critical to obtain objective metrics for the client-side web application.
@@ -176,10 +185,17 @@ The proper management of client-side data request traffic is critical to the per
176
185
- Defer the data request for as long as possible (that is, Lazy Load).
177
186
- Request the data only if, and when, it is actually needed; for example, as in response to a browser event or user action (that is, do not request data for a collapsed/hidden control; wait until the control is expanded/rendered).
178
187
179
-
#### Use a client-side cache to fulfill all data requests
180
-
181
-
- Consult the local data cache before issuing the data request to the server.
182
-
- Return cached data if it is present and not yet expired (for example, upon a cache hit).
188
+
#### Use a cache to fulfill all data requests
189
+
190
+
- For content that is user specific, like user profile information, cache the content to LocalStorage on the client.
191
+
- Consult the local data cache before issuing the data request to the server.
192
+
- Return cached data if it is present and not yet expired (for example, upon a cache hit).
193
+
- For content that is shared across multiple users - consider a middle-tier caching service.
194
+
- For content that is dynamically generated or updates frequently, like news articles, Azure Redis Cache or any similar such service should be used to cache the data.
195
+
- For static content, or content that is updated infrequently, like site navigation, consider writing this content to a JSON file and serving it from a CDN.
196
+
- To reduce costs at the middle-tier, clients can also cache the responses to LocalStorage.
197
+
198
+
For additional information, see [Caching](https://docs.microsoft.com/en-us/azure/architecture/best-practices/caching).
183
199
184
200
#### Call the server (or other back-end data source) only when a cache miss occurs
185
201
@@ -195,11 +211,11 @@ The proper management of client-side data request traffic is critical to the per
195
211
- A request-independent representation decouples the data from its data source and request semantics; this allows the data source to be easily changed (static, mock, live) as the solution is developed.
196
212
- JSON enables the use of JavaScript objects to which custom client-side display controls can easily bind; this also serves to define the working data contract between the UX and Data teams.
197
213
198
-
#### Store the data response in the client-side cache
214
+
#### Store the data response in a cache
199
215
200
-
- Store the JSON representation of the data response in the local data cache (for example, Web Storage).
201
-
- Use a public (local storage) cache for shared data (for example, Global Menu).
202
-
- Use a private (session storage) cache for personal data (for example, My Stocks).
216
+
- Store the JSON representation of the data response in the cache.
217
+
- Use a middle-tier cache for shared data (for example, Global Menu).
218
+
- Use a private (local storage) cache for personal data (for example, My Stocks).
203
219
- Use component-specific expiration values that align with the volatility of the associated data; for example, Global Menu data (30 mins), Stock Ticker data (5 mins).
204
220
- Be sure to store **No results** as well because it is a valid data response.
205
221
- Ensure cached data is available across all pages and components of the client-side web application.
@@ -236,14 +252,24 @@ In general, use SharePoint REST APIs for client-side data requests. When perform
236
252
- Keep the number of search queries as low as possible.
237
253
- Conduct regular query audits to consolidate redundant/similar queries that target the same data.
238
254
239
-
#### Client-side REST requests
255
+
#### Eliminate redundant calls
256
+
257
+
- Often multiple controls on a page will require data from a single source. If not properly planned, this can result in multiple similar service calls. Ensuring that the data retrieved by one control is available to others (where appropriate) can eliminate unnecessary round trips.
258
+
259
+
#### Request only what is requried
260
+
261
+
- The SharePoint client library allows a developer to specify the fields needed for their application and return only this data. This reduces costs at all layers.
262
+
263
+
For code samples demonstrating this technique, please see [Complete basic operations using SharePoint client library code](https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-client-library-code#retrieve-only-selected-properties-of-a-website)
264
+
265
+
#### Be mindful of aggregate request volumes
240
266
241
267
- Client-side REST requests to SharePoint Online are now subject to request throttling and even request blocking.
242
268
- Pay attention to the HTTP response codes/warnings of your data requests and alter your data request behavior accordingly to avoid data service disruptions in your client-side web applications.
243
269
244
270
For details about how to avoid being throttled or blocked, see [Avoid getting throttled or blocked in SharePoint Online](../general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md).
245
271
246
-
#### REST request traffic
272
+
#### Batch REST request traffic
247
273
248
274
- REST request traffic can be now be optimized via OData Batching.
249
275
- For more information, see [OData Batch Request Tutorial](http://www.odata.org/getting-started/advanced-tutorial/#batch) and the [OData Batch Request Protocol Spec](http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752313).
@@ -377,11 +403,11 @@ The [Client-Side Data Access Layer (DAL) Sample](https://github.com/SharePoint/P
377
403
378
404
- Performance is Feature #1.
379
405
- Core component of the overall client-side framework; to be leveraged by all custom client-side web applications and components for consistency and performance.
380
-
- Fulfill data requests via the client-side data cache; if a cache miss occurs, execute the client-to-server data fetch.
406
+
- Fulfill data requests via a data cache; if a cache miss occurs, execute the client-to-server data fetch.
381
407
- Fetch the server data via an asynchronous client-to-server AJAX call (never use a synchronous call).
382
408
- Reduce cascading call failures by re-using stale data when/if a data request fails.
383
409
- Honor request throttling responses and adjust behavior accordingly.
384
-
- Store the server data response in the client-side cache using a minimal, request-independent JSON representation.
410
+
- Store the server data response in the cache using a minimal, request-independent JSON representation.
385
411
- Support transient and durable storage options.
386
412
- Use transient storage for personal data and durable storage for shared data.
387
413
- Support absolute and sliding expiration policies.
0 commit comments