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
+48-15Lines changed: 48 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -92,9 +92,15 @@ The following sections provide performance guidance for achieving this goal.
92
92
93
93
<aname="bk_features"> </a>
94
94
95
-
### Disable the Device Channels and Search Engine Optimization features
95
+
### Disable unnecessary features in classic portals
96
96
97
-
If you create a new classic publishing portal then both the Device Channels as the Search Engine Optimization features are turned on with their default settings. If you keep these default settings there's no impact on your page rendering, but in SharePoint Online the presence of these two features does impact performance and therefore it's recommended to disable these features if you're no using them. See below [PnP PowerShell](https://aka.ms/sppnp-powershell) script to make this happen:
97
+
When the Publishing features are activated on a portal, both the Device Channels and the Search Engine Optimization (SEO) features are turned on with their default settings. The SEO feature is designed to boost search relevance and ranking in a publicly consumed portal. Since SharePoint Online no longer offers public websites, this feature is no longer required. It does, however, still add additional costs to your page rendering.
98
+
99
+
The Device Channels feature was originally designed to facilitate mobile rendering of Publishing Portals, however, much of this functionality has been supplanted by modern features like the Mobile Apps and the Modern UI. If you have not designed custom mobile masterpages for your portal, this feature should be disabled. Similar to the SEO feature, it adds additional cost and complexity to the server rendering of the page, which will ultimately degrade performance.
100
+
101
+
Both of these features are hidden from the site UI, so they must be deactivated with code. See the [PnP PowerShell](https://aka.ms/sppnp-powershell) script at the bottom of this section to forcibly disable these features:
102
+
103
+
The Metadata Navigation and Filtering feature, not to be confused with Managed Navigation, provides a way to dynamically filter list views based on metadata. While this may be useful for content authors to locate specific content requiring changes, it adds additional costs to each page render on sites where the feature is active. This is true not just of list views, but Publishing Pages as well. It is recommended to disable this feature on any portal where performance is of importance.
Disable-PnPFeature -Scope Site -Identity 57cc6207-aebf-426e-9ece-45946ea82e4a -Force
104
110
# SEO
105
111
Disable-PnPFeature -Scope Site -Identity 17415b1d-5339-42f9-a10b-3fef756b84d1 -Force
112
+
# MetadataNav
113
+
Disable-PnPFeature -Scope Web -Identity 7201D6A4-A5D3-49A1-8C19-19C4BAC6E668 -Force
106
114
```
107
-
108
115
<aname="bk_Telemetry"> </a>
109
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
+
110
126
### Use telemetry
111
127
112
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.
@@ -169,10 +185,17 @@ The proper management of client-side data request traffic is critical to the per
169
185
- Defer the data request for as long as possible (that is, Lazy Load).
170
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).
171
187
172
-
#### Use a client-side cache to fulfill all data requests
173
-
174
-
- Consult the local data cache before issuing the data request to the server.
175
-
- 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).
176
199
177
200
#### Call the server (or other back-end data source) only when a cache miss occurs
178
201
@@ -188,11 +211,11 @@ The proper management of client-side data request traffic is critical to the per
188
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.
189
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.
190
213
191
-
#### Store the data response in the client-side cache
214
+
#### Store the data response in a cache
192
215
193
-
- Store the JSON representation of the data response in the local data cache (for example, Web Storage).
194
-
- Use a public (local storage) cache for shared data (for example, Global Menu).
195
-
- 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).
196
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).
197
220
- Be sure to store **No results** as well because it is a valid data response.
198
221
- Ensure cached data is available across all pages and components of the client-side web application.
@@ -229,14 +252,24 @@ In general, use SharePoint REST APIs for client-side data requests. When perform
229
252
- Keep the number of search queries as low as possible.
230
253
- Conduct regular query audits to consolidate redundant/similar queries that target the same data.
231
254
232
-
#### 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
233
266
234
267
- Client-side REST requests to SharePoint Online are now subject to request throttling and even request blocking.
235
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.
236
269
237
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).
238
271
239
-
#### REST request traffic
272
+
#### Batch REST request traffic
240
273
241
274
- REST request traffic can be now be optimized via OData Batching.
242
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).
@@ -370,11 +403,11 @@ The [Client-Side Data Access Layer (DAL) Sample](https://github.com/SharePoint/P
370
403
371
404
- Performance is Feature #1.
372
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.
373
-
- 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.
374
407
- Fetch the server data via an asynchronous client-to-server AJAX call (never use a synchronous call).
375
408
- Reduce cascading call failures by re-using stale data when/if a data request fails.
376
409
- Honor request throttling responses and adjust behavior accordingly.
377
-
- 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.
378
411
- Support transient and durable storage options.
379
412
- Use transient storage for personal data and durable storage for shared data.
380
413
- Support absolute and sliding expiration policies.
0 commit comments