在 SharePoint Server 中規劃快取及效能Plan for caching and performance in SharePoint Server

摘要: 了解能夠改善瀏覽器效能的 BLOB 快取、位元速度節流設定及其他 SharePoint Server 功能。Summary: Learn about the BLOB cache, Bit Rate Throttling, and other SharePoint Server features that can improve browser performance.

SharePoint Server 提供磁碟型的二進位大型物件 (BLOB) 快取,可用來減少使用者的資料庫負載及增進瀏覽器效能。本文說明 BLOB 快取,告訴您該功能的使用方法及時機,並列出規劃使用時的重要考量。本文也包含位元速度節流設定使用時機的相關資訊,它是一個 Internet Information Services (IIS) 7.0 擴充功能,可讓使用者在將視訊作為管理 SharePoint Server 中數位資產的重要環節時,提升視訊的效能。最後,本文另外討論 SharePoint Server 中可用的其他快取類型、說明上傳檔案大小的限制,並且列出在伺服器上調整大小限制以傳輸檔案時應考量的事項。SharePoint Server provides a disk-based binary large object (BLOB) cache that reduces database load and increases browser performance for users. This article describes the BLOB cache, tells you how and when to use it, and lists key considerations for planning to use it. This article also contains information about when to use Bit Rate Throttling, an Internet Information Services (IIS) 7.0 extension that improves video performance for users when serving videos as part of managing digital assets in SharePoint Server. Finally, this article also discusses the other types of caches that are available in SharePoint Server, describes the limitations of upload file size restrictions, and lists considerations for adjusting the size limit for file transfers on the server.

如需如何啟用 BLOB 快取的詳細資訊,請參閱Configure cache settings for a web application in SharePoint Server。如需管理數位資產的詳細資訊,請參閱在 SharePoint Server 2013 中規劃數位資產庫For information about how to enable the BLOB cache, see Configure cache settings for a web application in SharePoint Server. For information about managing digital assets, see Plan digital asset libraries in SharePoint Server 2013.

磁碟型 BLOB 快取Disk-based BLOB caching

本節說明磁碟型 BLOB 快取,並且提供重要資訊,說明如何利用 SharePoint Server 部署來規劃快取使用。它說明如何為使用者決定 BLOB 快取的使用時機、儲存位置、啟用方式,以及如何設定快取大小來獲得最佳效能。This section describes the disk-based BLOB cache, and provides important information about how to plan to use the cache with a SharePoint Server deployment. It tells how to decide when to use the BLOB cache, where to store it, how to enable it, and how to configure the size of the cache to get the best performance for users.

BLOB 快取概觀BLOB cache overview

磁碟型 BLOB 快取可控制二進位大型物件 (BLOB) 的快取,例如經常使用的影像、音訊和視訊檔案,以及用於顯示網頁的其他檔案,例如 .css 和 .js 檔案。BLOB 快取可在前端網頁伺服器上啟用,並可從資料庫擷取 BLOB 檔案,然後將檔案儲存在使用者使用的前端網頁端伺服器的目錄中,從而增進效能。如此可降低至資料庫伺服器的網路流量及減輕其負載。The disk-based BLOB cache controls the caching for binary large objects (BLOBs), such as frequently used image, audio, and video files, and other files that are used to display web pages, such as .css and .js files. The BLOB cache is enabled on a front-end web server and improves performance by retrieving BLOB files from the database and storing them in a directory on the front-end web end server where they are served to users. This reduces the network traffic to and load on the database server.

BLOB 快取也支援將媒體檔案提供給使用者的功能。此類功能是支援位元組範圍的要求,能讓使用者選取視訊後端的某個點並立即開始播放。另一項功能是漸進式快取,可在大型視訊檔案開頭提供服務,同時快取檔案的剩餘部分。系統會將視訊檔案分割成較小的區段並加以擷取,以減輕前端與後端伺服器之間的負載。管理員可設定區段的大小。The BLOB cache also provides features that support serving media files to users. One such feature is support for byte-range requests, which lets users select a later point in the video and immediately begin playback. Another feature is progressive caching, which starts serving the beginning of a large video file while the rest of the file is being cached. Video files are divided and retrieved in smaller sections to reduce the load between the front-end and back-end servers. An administrator can configure the size of the sections.

BLOB 快取也是使用影像轉譯功能的先決條件。影像轉譯可讓您根據相同的來源影像,在發佈網站的不同網頁上顯示大小不同的影像版本。建立影像轉譯時,需要指定使用該影像轉譯之所有影像的寬度和高度。如需詳細資訊,請參閱 MSDN Library 中的<作法:在 SharePoint 中管理影像轉譯>。The BLOB cache is also a prerequisite for using the image renditions feature. Image renditions let you display different sized versions of an image on different pages in a publishing site, based on the same source image. When you create an image rendition, you specify the width and height for all images that use that image rendition. For more information, see How to: Manage image renditions in SharePoint in the MSDN Library.

決定是否使用 BLOB 快取Decide whether to use the BLOB cache

啟用時,BLOB 快取會快取各種影像、音訊和視訊檔案,以及 .css 與 .js 檔案。管理員可變更設定來新增或移除要快取之檔案類型的副檔名。此功能可讓您盡可能快取最多的檔案類型,或限制快取某種類型的檔案。例如,若有對網際網路開放的入口網站,且該網站包含 .doc 或 .pdf 檔案之類的唯讀檔案,則您可以指定快取那些檔案,以便更快速向使用者顯示那些檔案。如果有共同作業網站包含經常更新的檔案,且另外包含媒體資產,則可在快取設定中僅包含所要的音訊或視訊類型檔案的副檔名,讓快取僅儲存這些類型的檔案。When enabled, the BLOB cache caches various image, audio, and video files, together with .css and .js files. An administrator can change the settings to add or remove file name extensions of file types to be cached. This functionality lets you either cache as many file types as possible, or to restrict the cache to certain kinds of files. For example, if you have an Internet-facing portal with read-only files such as .doc or .pdf files, you can specify that those files be cached so that they are displayed more quickly to users. If you have a collaboration site that contains files that are frequently updated, and also media assets, you can specify that the cache is to store only audio or video types by including only file name extensions for those files in the cache settings.

啟用 BLOB 快取之前,請仔細考量計劃使用快取的情況。如果網站將使用於大量共同作業,則啟用 BLOB 快取時可能會在將快取的檔案第一次寫入磁碟時,暫時影響網站的效能。在快取中儲存檔案後將改善網站效能,因此當您決定是否啟用快取時請考量此因素。請依據下列準則決定是否啟用 BLOB 快取:Before you enable the BLOB cache, carefully consider the scenario in which you plan to use it. If your site will be used for heavy collaboration, enabling the BLOB cache might temporarily affect the performance of your site while the files to be cached are first written to the disk. After the files have been stored in the cache, site performance will improve, so take this into consideration when you decide whether to enable the cache. Base your decision to enable BLOB caching on the following criteria:

  • 對於大多數訪客皆匿名,或大多數檔案都是靜態內容的發佈網站,盡可能為最多的檔案類型啟用 BLOB 快取。For a publishing site for which most of the visitors are anonymous or where most of the files are static content, enable the BLOB cache for as many file types as possible.

  • 對於計劃使用影像轉譯功能的發佈網站,必須啟用 BLOB 快取。For a publishing site that plans to use the image renditions feature, you must enable the BLOB cache.

  • 對於包含許多唯讀媒體資產,或只會更新小比例之媒體資產的其他網站,僅針對媒體檔案啟用 BLOB 快取。For other sites that contain lots of media assets that are read-only, or where only a small percentage of the media assets are updated, enable the BLOB cache for media files only.

每個 Web 應用程式有一個 BLOB 快取。如果計劃將 BLOB 快取與預期的大型資產庫搭配使用,或搭配將接收龐大流量的網站,請考慮將包含資產庫的網站集合放到其本身的 Web 應用程式,讓它僅接收其本身的 BLOB 快取。如此能確保其他資產不會用盡 BLOB 快取中,原本要配置給資產庫項目的空間。它也能確保接收大量流量的網站,不會阻礙接收少量流量的其他網站從 BLOB 快取中獲益。There is one BLOB cache per web application. If you plan to use the BLOB cache together with an asset library that you expect will be large, or together with a site that will receive lots of traffic, consider putting the site collection that contains the asset library into its own web application so that it receives its own BLOB cache. This will ensure that other assets are not using up space in the BLOB cache that you want allocated to items in the asset library. It will also ensure that sites which receive lots of traffic do not prevent other sites which receive less traffic from benefitting from the BLOB cache.

儲存 BLOB 快取Store the BLOB cache

啟用 BLOB 快取時,必須在前端網頁伺服器上指定位置來儲存檔案。依預設,將在安裝 SharePoint Server 的磁碟機上建立快取。請務必將 BLOB 快取,放置在有足夠磁碟空間來儲存快取的磁碟機中。此外,盡可能選取最少程序使用的磁碟機,讓 BLOB 快取程序在嘗試存取磁碟機時不致發生衝突。如果有過多程序競爭 BLOB 快取所在的磁碟機之磁碟存取權,將對 BLOB 快取效能和其他程序產生負面影響。When you enable the BLOB cache, you must specify a location on the front-end web server where the files will be stored. By default, the cache will be created on the drive on which SharePoint Server is installed. Make sure that you put the BLOB cache on a drive that has sufficient disk space available in which to store the cache. Also, select a drive that will be used by as few processes as possible so that the BLOB cache process does not encounter conflicts when it tries to access the drive. If too many processes compete for disk access on the drive where the BLOB cache is located, BLOB cache performance and other processes will be adversely affected.

如果計劃在大量使用快取的情況中使用 BLOB 快取 (例如在高流量環境中播放視訊),並且將使用 ULS 記錄檔,請考慮將 BLOB 快取與 ULS 記錄檔放在不同的實體磁碟機 不是不同的磁碟分割。在相同的磁碟機上儲存 BLOB 快取和 ULS 記錄檔可能會導致低劣的伺服器效能。如果將 BLOB 快取和 ULS 記錄檔放在相同的實體磁碟機,請務必密切監視磁碟佇列長度,以免對效能產生任何影響。If you plan to use the BLOB cache in a scenario with heavy cache use, such as serving videos in a high traffic environment, and if you will use ULS logging, consider placing the BLOB cache on a separate physical drive from the ULS log — not on a separate partition. Storing the BLOB cache and the ULS log on the same drive can result in poor server performance. If you place the BLOB cache and the ULS log on the same physical drive, make sure that you closely monitor the disk queue length for any performance effect.

每一台前端網頁伺服器都會針對檔案接收要求,建立其本身的 BLOB 快取本機複本。如果在多台前端網頁伺服器之間使用負載平衡,則每一台伺服器將包含其本身的快取。當第一台伺服器要求檔案時,系統只會將檔案快取至該伺服器。如果接下來有第二台伺服器要求相同的檔案,則會將第二個要求傳送至資料庫伺服器,以便將檔案擷取至第二台伺服器上的快取。Each front-end web server has its own local copy of the BLOB cache that is built as requests for files are received. If you use load balancing with multiple front-end web servers, each server contains its own cache. When a file is requested by the first server, it is cached to that server only. If the next request for the same file comes from a second server, a second request is sent to the database server to retrieve the file to the cache on the second server.

啟用 BLOB 快取Enable the BLOB cache

BLOB 快取是在 Web.config 檔案中為每一個 Web 應用程式所設定,且預設不會啟用。您必須手動啟用 BLOB 快取才能獲得快取提供的效能優勢。如需如何啟用 BLOB 快取的詳細資訊,請參閱Configure cache settings for a web application in SharePoint ServerThe BLOB cache is configured in the web.config file for each web application and, by default, is not enabled. You must specifically enable the BLOB cache to get the performance advantage it provides. For information about how to enable the BLOB cache, see Configure cache settings for a web application in SharePoint Server.

指定 BLOB 快取的大小Specify the size of the BLOB cache

決定製作的 BLOB 快取大小時,必須考量檔案的數量和大小來決定快取中存取的資料大小總計。依預設,BLOB 快取會設定為 10 GB。磁碟機上的空間至少必須比快取大小多 20%。例如,若有 100 GB 內容,請在至少有 150 GB 空間的磁碟機上,將快取大小設為 120 GB。如果 BLOB 快取過小,則將檔案提供給使用者的速度會變慢,進而降低網站的效能。When you decide how large to make the BLOB cache, you must consider the number and size of the files to determine the total size of the data to be stored in the cache. By default, the BLOB cache is set to 10 gigabytes (GB). Allow at least 20 percent more space on the drive than the size of the cache. For example, if you have 100 GB of content, set the size of the cache to 120 GB on a drive that has at least 150 GB of space. If the BLOB cache is too small, serving files to users slows, reducing the performance of your site.

如果計劃在網站上使用影像轉譯功能,您應該將每一次轉譯視為快取中的個別 BLOB。例如,如果計劃每個影像有五次轉譯,則配置的空間必須遠大於磁碟機上一般預估配置的 20% 空間。If you plan to use the image renditions feature on your site, you should account for each rendition being a separate BLOB in the cache. For example, if you plan to have five renditions per image, then you must allocate significantly more than the general estimate of 20 percent more space on the drive.

輸出快取、物件快取和匿名搜尋結果快取Output cache, object cache, and anonymous search results cache

除了 BLOB 快取,SharePoint Server 還提供下列快取類型來協助增進瀏覽器中載入網頁的速度:In addition to the BLOB cache, SharePoint Server provides the following types of caches that help improve the speed at which web pages load in the browser:

注意

您必須在網站上使用發佈功能才能使用輸出快取或物件快取。You must be using the Publishing feature on your site to use the output cache or the object cache.

  • 輸出快取:儲存頁面的轉譯輸出。它也能根據要求頁面的使用者權限來儲存不同版本的快取頁面。Output cache: Stores the rendered output of a page. It also stores different versions of the cached page, based on the permissions of the users who are requesting the page.

    快取設定檔說明每一種頁面輸出快取類型的特定快取設定。網站集合管理員可在網站集合層級上,於使用者介面中進行快取設定檔設定,管理員亦可在前端網頁伺服器,於 Web 應用程式層級上進行設定。必須先在網站集合層級上啟用頁面輸出快取,才能在網站集合層級或 Web 應用程式層級上設定頁面輸出快取設定檔。如需詳細資訊,請參閱Configure cache profile settingsCache profiles describe specific cache settings for each type of page output cache. Cache profile settings can be configured in the user interface at the site collection level by a site collection administrator, and also at the web application level by an administrator on the front-end web server. The page output cache must be enabled at the site collection level before page output cache profiles can be configured at either the site collection level or web application level. For more information, see Configure cache profile settings.

  • 物件快取:藉由在前端網頁伺服器的記憶體中儲存物件,以減少網頁伺服器與 SQL 資料庫之間的流量,例如清單和檔案庫、網站設定和版面配置。因此,可快速轉譯需要這些項目的頁面,從而增進頁面傳遞至用戶端瀏覽器的速度。Object cache: Reduces the traffic between the web server and the SQL database by storing objects such as lists and libraries, site settings, and page layouts in memory on the front-end web server. As a result, the pages that require these items can be rendered quickly, increasing the speed with which pages are delivered to the client browser.

    網站集合管理員可在使用者介面中,於網站集合層級上進行物件快取設定,這個動作預設會開啟。可在前端網頁伺服器的 Web 應用程式層級上設定最大快取大小,以便限制快取將使用於所有網站集合的記憶體量上限。如需詳細資訊,請參閱Configure object cache settingsThe object cache settings can be configured at the site collection level in the user interface by a site collection administrator, and is on by default. The maximum cache size can be configured at the web application level on the front-end web server to place a restriction on the maximum amount of memory that the cache will use for all site collections. For more information, see Configure object cache settings.

  • 匿名搜尋結果快取:主要由發佈網站使用,目的是允許存取匿名使用者。匿名搜尋結果快取會儲存匿名使用者的搜尋結果,並在後續執行與原始查詢相同的查詢時重複使用。如此可改善使用「內容搜尋網頁組件」的網站網頁效能。Anonymous search results cache: Used primarily by publishing sites that allow access to anonymous users. The anonymous search results cache saves search results from anonymous users and reuses them for later queries that are the same as the original query. This improves performance on site pages that use the Content Search Web Part.

位元速度節流設定Bit Rate Throttling

本節包含位元速度節流設定的詳細資訊,說明何時應將該設定與 SharePoint Server 解決方案搭配使用,以及說明如何啟用它。This section contains information about Bit Rate Throttling, describes when you should use it with the SharePoint Server solution, and explains how to enable it.

位元速度節流設定概觀Bit Rate Throttling overview

「位元速度節流設定」是 IIS 7.0 擴充功能,可測量伺服器與用戶端電腦之間的媒體檔案類型和資料的下載速度。系統會自動偵測編碼的媒體檔案類型 (例如 Windows Media 視訊 (WMV)、MPEG-4 (MP4) 和 Adobe Flash Video) 的位元速度,並且會根據「位元速度節流設定」設定,控制透過 HTTP 將檔案傳遞給用戶端的速度。如需詳細資訊,請參閱位元速度節流設定Bit Rate Throttling is an IIS 7.0 extension that meters the download speeds of media file types and data between a server and a client computer. The encoded bit rates of media file types such as Windows Media Video (WMV), MPEG-4 (MP4), and Adobe Flash Video, are automatically detected, and the rate at which those files are delivered to the client over HTTP are controlled according to the Bit Rate Throttling configuration. For more information, see Bit Rate Throttling.

決定使用位元速度節流設定Decide to use Bit Rate Throttling

若要讓 SharePoint Server 中的使用者長期使用視訊資產,請在 IIS 中啟用 [位元速度節流設定]。若欠缺「位元速度節流設定」,IIS 會盡可能使用最多的頻寬來提供視訊檔案,從而提升網路效能。在 IIS 中啟用 [位元速度節流設定] 時,它只會使用支援漸進式下載及觀賞視訊所需的頻寬來提供視訊檔案。如果另外啟用 BLOB 快取,位元速度節流設定將針對快取至磁碟的檔案使用副檔名規則。系統會根據加密位元速度的壓縮大小百分比,將使用「位元速度節流設定」從 BLOB 快取中取出的檔案傳送至用戶端。例如,如果您組織中的視訊小於 10 MB,您可能決定不使用位元速度節流設定,因為這麼做可能會影響使用者將視訊下載到其本機電腦的速度。然而,如果您正在提供視訊檔案,則啟用「位元速度節流設定」可控制檔案下載到用戶端電腦的速度。If you will make long-playing video assets available to users in SharePoint Server, enable Bit Rate Throttling in IIS. Without Bit Rate Throttling, IIS will serve video files by using as much bandwidth as it can, which will result in increased network performance. When you enable Bit Rate Throttling in IIS, it will serve video files that use only as much bandwidth as is needed to support progressive downloading and viewing of videos. When the BLOB cache is also enabled, Bit Rate Throttling uses extension rules for files cached to disk. Files that are served from the BLOB cache by using Bit Rate Throttling are sent to the client based on a percentage of the compressed size using the encoded bit rate. For example, if the videos in your organization are smaller than 10 MB, you may decide not to use Bit Rate Throttling because it will affect how fast users can download videos to their local computers. However, if you are serving video files, enable Bit Rate Throttling to control the speed at which files are downloaded to client computers.

注意

如果未先啟用 BLOB 快取,並將其設定為快取要節流的檔案類型,則位元速度節流設定將無法正確運作。Bit rate throttling will not work correctly if you do not first enable the BLOB cache and configure it to cache the files types that you want to throttle.

啟用位元速度節流設定Enable Bit Rate Throttling

若要在 IIS 7.0 中啟用 [位元速度節流設定],您必須安裝 IIS Media Services 2.0。如需如何安裝 IIS Media Services 2.0 的詳細資訊,請參閱位元速度節流設定讀我檔案。如需如何設定位元速度節流設定的詳細資訊,請參閱位元速度節流設定設定逐步解說To enable Bit Rate Throttling in IIS 7.0, you must install IIS Media Services 2.0. For information about how to install IIS Media Services 2.0, see Bit Rate Throttling Readme. For information about how to configure Bit Rate Throttling, see Bit Rate Throttling Configuration Walkthrough.

上傳檔案大小上限Maximum upload file size

本節說明上傳檔案大小限制,告訴您如何決定應有的上傳檔案大小上限及其設定方式。This section describes the upload file size limitation, tells how to decide what the maximum upload file size limit should be, and how to configure it.

上傳檔案大小上限概觀Maximum upload file size overview

上傳檔案大小上限是 SharePoint Server Web 應用程式所使用的設定,可指定使用者能上傳到伺服器的檔案大小上限。建立新 Web 應用程式時,SharePoint Server 會將預設的上傳大小設為 250 MB。如果使用者嘗試上傳比指定的上傳大小上限更大的檔案,上傳將失敗。The maximum upload file size is a setting that is used by the SharePoint Server web application that specifies the maximum size of a file that a user can upload to the server. When a new web application is created, SharePoint Server sets the default maximum upload size to 250 MB. If a user tries to upload a file larger than the specified maximum upload size, the upload will fail.

決定上傳檔案大小上限Decide maximum upload file size

將檔案上傳至檔案庫的每個使用者都會使用連至伺服器的連線,並增加資料庫的資料量。這會影響伺服器的負載、回應時間和資料容量。依據您的情況,若未將伺服器設定為處理較大量的檔案,則上述作法可能會對伺服器效能產生負面影響。若要判定伺服器應有的上傳檔案大小限制,請考量網站的使用者數目,以及使用者將上傳的檔案大小。例如,如果使用者基本上將上傳 500 GB 的視訊檔案,則上傳檔案大小限制必須夠大,才能讓使用者得以輕易容納將上傳的最大檔案。計劃調整上傳檔案大小限制時,請注意,這麼做也會直接影響伺服器環境的容量規劃。如需規劃大媒體檔案的儲存詳細資訊,請參閱<在 SharePoint Server 2013 中規劃數位資產庫>。Every user that uploads a file to a library uses a connection to the server and increases the amount of data in the database. This impacts the load, response time and data capacity for a server. Depending on your scenario, this can negatively impact your server performance if the server is not configured to handle larger volumes of files. To determine what the upload file size limit should be for your server, consider the number of users for your site, and the size of the files they will upload. For example, if your users will primarily be uploading video files that are 500 MB, the upload file size limit should be large enough to easily accommodate the largest files users will upload. When planning to adjust the upload file size limit, keep in mind that this will also directly impact capacity planning for your server environment. For more information about planning for storage of large media files, see Plan digital asset libraries in SharePoint Server 2013.

設定上傳檔案大小上限Configure the maximum upload file size

若要在 SharePoint_Server 中設定上傳檔案大小,伺服器陣列管理員必須在 [管理中心] 的 [Web 應用程式一般設定] 頁面上變更 [最大上傳大小]**** 值。To configure the upload file size in SharePoint_Server, a farm administrator must change the Maximum Upload Size value on the Web Application General Settings page in Central Administration.

注意

如果您增加 Web 應用程式預設的最大上傳大小,而且也計劃使用內容部署,將 Web 應用程式中的網站集合內容移至其他伺服器陣列或網站集合,您也必須在目的地伺服器上增加預設的最大上傳大小,否則內容部署工作將失敗。If you increase the default maximum upload size for a web application, and you also plan to use content deployment to move content from site collections within that web application to another farm or site collection, you must also increase the default maximum upload size on the destination server, or the content deployment job will fail.

另請參閱See also

概念Concepts

在 SharePoint Server 2016 中監視快取效能Monitor cache performance in SharePoint Server 2016