Skip to content

Commit ed7a105

Browse files
authored
Update portal-performance.md
1 parent a48e3d5 commit ed7a105

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

docs/solution-guidance/portal-performance.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ Disable-PnPFeature -Scope Web -Identity 7201D6A4-A5D3-49A1-8C19-19C4BAC6E668 -Fo
114114
```
115115
<a name="bk_Telemetry"> </a>
116116

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+
117126
### Use telemetry
118127

119128
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
176185
- Defer the data request for as long as possible (that is, Lazy Load).
177186
- 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).
178187

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).
183199

184200
#### Call the server (or other back-end data source) only when a cache miss occurs
185201

@@ -195,11 +211,11 @@ The proper management of client-side data request traffic is critical to the per
195211
- 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.
196212
- 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.
197213

198-
#### Store the data response in the client-side cache
214+
#### Store the data response in a cache
199215

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).
203219
- 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).
204220
- Be sure to store **No results** as well because it is a valid data response.
205221
- 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
236252
- Keep the number of search queries as low as possible.
237253
- Conduct regular query audits to consolidate redundant/similar queries that target the same data.
238254

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
240266

241267
- Client-side REST requests to SharePoint Online are now subject to request throttling and even request blocking.
242268
- 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.
243269

244270
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).
245271

246-
#### REST request traffic
272+
#### Batch REST request traffic
247273

248274
- REST request traffic can be now be optimized via OData Batching.
249275
- 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
377403

378404
- Performance is Feature #1.
379405
- 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.
381407
- Fetch the server data via an asynchronous client-to-server AJAX call (never use a synchronous call).
382408
- Reduce cascading call failures by re-using stale data when/if a data request fails.
383409
- 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.
385411
- Support transient and durable storage options.
386412
- Use transient storage for personal data and durable storage for shared data.
387413
- Support absolute and sliding expiration policies.

0 commit comments

Comments
 (0)