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

摘要:了解如何監視 SharePoint BLOB 快取、ASP.NET 輸出快取及 SharePoint 物件快取。Summary: Learn how to monitor the SharePoint BLOB cache, the ASP.NET output cache, and the SharePoint object cache.

透過監視快取效能,您可確定伺服器陣列快取設定正確,並且以最大效能執行。By monitoring cache performance, you can make sure that that the farm cache settings are correct and that the caching is running at maximum performance.

關於快取監視About cache monitoring

SharePoint Server 2016 提供三種快取類型協助改善瀏覽器中網頁載入的速度:BLOB 快取、ASP.NET 輸出快取及物件快取。SharePoint Server 2016 provides three types of caches that help improve the speed at which web pages load in the browser: the BLOB cache, the ASP.NET output cache, and the object cache.

  • BLOB 快取是一種磁碟式快取,可儲存網頁用以協助在瀏覽器頁面快速載入的二進位大型物件檔案。The BLOB cache is a disk-based cache that stores binary large object files that are used by web pages to help the pages load quickly in the browser.

  • ASP.NET 輸出快取可儲存頁面的轉譯輸出,亦可根據正在要求頁面的使用者權限,儲存不同的快取頁面版本。The ASP.NET 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.

  • 物件快取可透過將清單和文件庫、網站設定及頁面的版面配置儲存至前端網頁伺服器的記憶體,來減少網頁伺服器和 SQL 資料庫之間的流量。因此,需要這些項目的頁面可以快速地轉譯,在頁面傳送至用戶端瀏覽器時加快速度。The 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.

監視包含定期檢視特定效能監視器以及調整設定以校正任何效能問題兩部分。監視器可測量快取點擊、快取遺漏、快取壓縮及快取清除。下列清單說明這些效能監視器。Monitoring consists of regularly viewing specific performance monitors and making adjustments in the settings to correct any performance issues. The monitors measure cache hits, cache misses, cache compactions, and cache flushes. The following list describes each of these performance monitors.

  • 在快取收到其資料已儲存於快取中的物件要求時,便會發生 快取點擊。大量的快取點擊代表效能優異,以及良好的使用者體驗。A cache hit occurs when the cache receives a request for an object whose data is already stored in the cache. A high number of cache hits indicates good performance and a good end-user experience.

  • 在快取收到其資料尚未儲存於快取中的物件要求時,便會發生 快取遺漏。大量的快取遺漏可能代表效能低落,以及遲緩的使用者體驗。A cache miss occurs when the cache receives a request for an object whose data is not already stored in the cache. A high number of cache misses might indicate poor performance and a slower end-user experience.

  • 在快取填滿、收到其他非快取內容要求之時,會發生 快取壓縮 (亦稱為修剪)。在壓縮期間,系統會識別在快取中要移除的內容子集,並加以移除。一般不會經常要求這些內容。Cache compaction (also known as trimming), happens when a cache becomes full and additional requests for non-cached content are received. During compaction, the system identifies a subset of the contents in the cache to remove, and removes them. Typically these contents are not requested as frequently.

    壓縮會耗用絕大部分的伺服器資源,這可能會影響伺服器效能和使用者體驗。因此,應該避免進行壓縮。您可透過增加快取大小來減少壓縮進行的機率。壓縮通常發生於降低快取大小之時。物件快取壓縮不像 BLOB 壓縮會耗用那麼多資源。Compaction can consume a significant portion of the server's resources. This can affect both server performance and the end-user experience. Therefore, compaction should be avoided. You can decrease the occurrence of compaction by increasing the size of the cache. Compaction usually happens if the cache size is decreased. Compaction of the object cache does not consume as many resources as the compaction of the BLOB cache.

  • 快取清除發生於快取完全清空時。在快取清除後,快取點擊對快取遺漏的比率幾乎為零。此外,當使用者要求內容,而快取已填滿的時,該比率就會增加,最後達到最佳層級。此計數器持續保持高數值,可能表示伺服器陣列發生問題,例如經常變更文件庫中繼資料結構描述。A cache flush is when the cache is completely emptied. After the cache is flushed, the cache hit to cache miss ratio will be almost zero. Then, as users request content and the cache is filled up, that ratio increases and eventually reaches an optimal level. A consistently high number for this counter might indicate a problem with the farm, such as constantly changing library metadata schemas.

您可監視快取設定的效率以確保使用者可獲得最佳體驗。快取點擊對快取遺漏的比率為高,同時很少發生壓縮和清除的狀況,便為最佳效能。如果監視並未指出這些條件,您可透過變更快取設定來提升效能。You can monitor the effectiveness of the cache settings to make sure that the end-users are getting the best experience possible. Optimum performance occurs when the ratio of cache hits to cache misses is high and when compactions and flushes only rarely occur. If the monitors do not indicate these conditions, you can improve performance by changing the cache settings.

下列部分章節提供監視每一種快取的特定資訊。The following sections provide specific information for monitoring each kind of cache.

監視 BLOB 快取效能Monitoring BLOB cache performance

您可使用下表所列之效能監視器來監視快取設定的效率。You can monitor the effectiveness of the cache settings by using the performance monitors that are listed in the following table.

SharePoint 發佈快取計數器群組SharePoint Publishing Cache counter group

計數器名稱Counter name 理想值或模式Ideal value or pattern 附註Notes
快取壓縮總數Total Number of cache Compactions
00
如果此數字持續或經常升高,表示快取大小對正在要求的資料而言過小。若要提升效能,請增加快取大小。If this number is continually or frequently high, the cache size is too small for the data being requested. To improve performance, increase the size of the cache.
BLOB 快取使用 %BLOB Cache % full
>= 90% 顯示紅色>= 90% shows red
>= 80% 顯示黃色>= 80% shows yellow
<80% 顯示綠色<80% shows green
這可顯示快取大小過小。若要提升效能,請增加快取大小。This can show that the cache size is too small. To improve performance, increase the size of the cache.
發佈快取清除 / 秒Publishing cache flushes / second
00
網站擁有人可能正在造成快取即將清除的網站上執行動作。若要改善尖峰使用時段的效能,請確認網站擁有人僅於離峰時間執行這些動作。Site owners might be performing actions on the sites that are causing the cache to be flushed. To improve performance during peak-use hours, make sure that site owners only perform these actions during off-peak hours.
發佈快取點擊比率Publishing cache hit ratio
根據使用模式。若為唯讀網站,比率應該為 1;若為讀寫網站,比率可能較低。Depends on usage pattern. For read-only sites, the ratio should be 1. For read-write sites, the ratio may be lower.
低比率可表示正在要求未發佈的項目,而這些項目均無法加以快取。如果此為入口網站,則網站可能會設為需要檢查,或多位使用者已取出項目。A low ratio can indicate that unpublished items are being requested, and these cannot be cached. If this is a portal site, the site might be set to require check-out, or many users have items checked out.

注意

若為 BLOB 快取,如果使用者所要求的檔案,其副檔名經過設定即將予以快取,則要求才會被視為快取遺漏。例如,若快取啟用為僅快取 .jpg 檔案,而快取卻收到索取 .gif 檔案的要求,則該要求不會被視為快取遺漏。For the BLOB cache, a request is only counted as a cache miss if the user requests a file whose extension is configured to be cached. For example, if the cache is enabled to cache .jpg files only, and the cache gets a request for a .gif file, that request is not counted as a cache miss.

監視 ASP.NET 輸出快取效能Monitoring ASP.NET output cache performance

您可使用下表所列之效能監視器來監視快取設定的效率。You can monitor the effectiveness of the cache settings by using the performance monitors that are listed in the following table.

ASP.NET 應用程式計數器群組ASP.NET Applications counter group

計數器名稱Counter name 理想值或模式Ideal value or pattern 附註Notes
快取 API 修剪Cache API trims
00
增加配置給 ASP.NET 輸出快取的記憶體容量。Increase the amount of memory that is allocated to the ASP.NET output cache.
快取 API 點擊比率Cache API hit ratio
根據使用模式。若為唯讀網站,比率應該為 1;若為讀寫網站,比率可能較低。Depends on usage pattern. For read-only sites, the ratio should be 1. For read-write sites, the ratio may be lower.
低點擊比率的可能原因包含下列因素:Potential causes of a low hit ratio include the following:
如果您使用的是匿名使用者快取 (例如,對網際網路開放的網站),使用者經常要求尚未快取的內容。If you are using anonymous user caching (for example, for an Internet-facing site), users are regularly requesting content that has not yet been cached.
如果您使用的是已驗證之使用者的 ASP.NET 輸出快取,許多使用者可能會擁有所檢視之頁面的編輯權限。If you are using ASP.NET output caching for authenticated users, many users may have edit permissions on the pages that they are viewing.
如果已在任何頁面 (或主要頁面或頁面配置) 自訂任何 VaryBy\* 參數或自訂快取設定檔,您可能已經設定了防止網站頁面遭到有效快取的參數 (例如,若為擁有許多使用者的網站,您可能會因為使用者而有所變動)。If you have customized any of the VaryBy\* parameters on any page (or master page or page layout) or customized a cache profile, you may have configured a parameter that prevents the pages in the site from being cached effectively (For example, you might be varying by user for a site that has many users).

注意

若為 ASP.NET 輸出快取,所有頁面都會在固定的持續期間進行快取,不受使用者的動作影響。因此,會有清除相關的監視事件。For the ASP.NET output cache, all pages are cached for a fixed duration that is independent of user actions. Therefore, there are flush-related monitoring events.

如需 ASP.NET 輸出快取的詳細資訊,請參閱輸出快取及快取設定檔 (https://go.microsoft.com/fwlink/p/?LinkID=121543) (英文) 或 caching 的 cache 項目 (ASP.NET 設定結構描述) (https://go.microsoft.com/fwlink/p/?LinkId=195986)。For more information about the ASP.NET output cache, see Output Caching and Cache Profiles (https://go.microsoft.com/fwlink/p/?LinkID=121543) or cache Element for caching (ASP.NET Settings Schema) (https://go.microsoft.com/fwlink/p/?LinkId=195986).

監視物件快取效能Monitoring object cache performance

物件快取用於儲存有關網站、文件庫、清單、清單項目,以及網站導覽和內容查詢網頁組件等功能所使用之文件。在使用者因為所需的資料直接從物件快取儲存或擷取 (非從內容資料庫) 而瀏覽使用這些功能的頁面時,此快取可協助使用者。The object cache is used to store metadata about sites, libraries, lists, list items, and documents that are used by features such as site navigation and the Content Query Web Part. This cache helps users when they browse to pages that use these features because the data that they require is stored or retrieved directly from the object cache instead of from the content database.

物件快取儲存於伺服器陣列中每個網頁伺服器的 RAM。每個網頁伺服器會維護本身的物件快取。The object cache is stored in the RAM of each web server in the farm. Each web server maintains its own object cache.

您可使用下表所列之效能監視器來監視快取設定的效率。You can monitor the effectiveness of the cache settings by using the performance monitors that are listed in the following table.

SharePoint 發佈快取計數器群組SharePoint Publishing Cache counter group

計數器名稱Counter name 理想值或模式Ideal value or pattern 附註Notes
快取壓縮總數Total number of cache compactions
00
如果此數字為高,表示快取大小對正在要求的資料而言過小。若要提升效能,請增加快取大小。If this number is high, the cache size is too small for the data being requested. To improve performance, increase the size of the cache.
發佈快取清除 / 秒Publishing cache flushes / second
00
網站擁有人可能正在造成快取即將清除的網站上執行動作。若要改善尖峰使用時段的效能,請確認網站擁有人僅於離峰時間執行這些動作。Site owners might be performing actions on the sites that are causing the cache to be flushed. To improve performance during peak-use hours, make sure that site owners perform these actions only during off-peak hours.
發佈快取點擊比率Publishing cache hit ratio
根據使用模式。若為唯讀網站,比率應該為 1;若為讀寫網站,比率可能較低。Depends on usage pattern. For read-only sites, the ratio should be 1. For read-write sites, the ratio may be lower.
如果比率開始降低,則可能由下列一項或多項原因所導致:If the ratio starts to decrease, this might be caused by one or more of the following:
近期清除或壓縮快取。The cache was recently flushed or compacted.
使用者正在存取近期新增至網站的內容。這可能會發生於大量新內容新增至網站之後。Users are accessing content that was recently added to the site. This might occur after lots of new content is added to the site.