Question 102
You are designing a Windows application that accesses information stored on a SharePoint 2010 intranet site. The application displays employee information in a data grid sourced from a list on the Human Resources site. To filter and manipulate the employee details list, the design includes a class to cache the data that is accessed. The class keeps the SPWeb object open, but only retrieves data that is not already cached. You need to ensure proper memory utilization and resource management for the application. Which approach should you recommend?
A. Implement the class with the IDisposable interface and allow the .NET Framework garbage collector to automatically manage the SPWeb object disposal.
B. Implement the class with the IDisposable interface and explicitly dispose of the SharePoint SPWeb object when you are finished using it.
C. Implement the class as a fully managed .Net Framework object and allow the .NET Framework garbage collector to automatically manage the SPWeb object disposal.
D. Implement the class as a fully managed .Net Framework object and explicitly manage the SPWeb object using the ISPerformanceMonitor interface.緩存
解析:
你開發了一個Windows應用程序去獲取存儲在Sharepoint 站點列表中的數據,此列表存儲了公司員工信息,你的Windows應用程序將會在一個Data Grid控件中顯示這些員工信息,爲了便於對這些信息進行過濾和處理,你使用了一個類去緩存這些信息, 此類讓SPWeb對象保持打開, 當Windows應用程序想查詢某些數據,而這些數據在此緩存中找不到時纔去訪問Sharepoint站點列表資源,你須要確保內存的合理使用和應用程序對資源的合理管理。
本題涉及Sharepoint對象的建立與內存回收,咱們知道,一些 SharePoint Foundation 對象(主要是 SPSite 類和 SPWeb 類對象)被建立爲託管對象。可是,這些對象使用非託管代碼和內存來執行其大多數工做。對象的託管部件比非託管部件小得多。由於較小的託管部件不會給垃圾收集器施加內存壓力,因此垃圾收集器不會及時從內存中釋放對象。若是對象使用大量非託管內存,則可能致使前面描述的某些異常行爲。在 SharePoint Foundation 中處理 IDisposable 對象的調用應用程序在使用完這些對象後必須釋放它們。不該該依賴垃圾收集器從內存中自動釋放對象。因此,只有選項B符合要求。
選項A,依賴於垃圾收集器從內存中自動釋放對象,因此不對。
選項C.D,都是建立徹底的託管對象,而SPWeb與SPSite涉及非託管代碼,因此也應該被排除。
所以本題答案應該選 B架構
參考
http://msdn.microsoft.com/en-au/library/ee557362(v=office.14).aspx
http://blogs.msdn.com/b/rogerla/archive/2009/01/14/try-finally-using-sharepoint-dispose.aspxapp
Question 103
You are asked to analyze a SharePoint 2010 system that is experiencing performance problems, especially under heavy loads. The system contains multiple custom Web applications and third-party Web Parts. The performance problems are exhibiting the following symptoms:
.The application pool recycles frequently.
.The system experiences slow client response times.
.The system experiences excessive page faults.
You need to identify a possible source of these performance issues and suggest a way to verify your analysis. What should you do?
A. Propose that the custom code in the third-party application is not disposing of its objects properly, and verify the theory by checking the Unified Logging Service (ULS) logs for entries related to the SPRequest object.
B. Propose that the paging file size is too large, and verify the theory by using the System Monitor to see if the % Usage counter for the paging file is 50% or less.
C. Propose that the application pool recycle setting should be changed to recycle less frequently and verify the theory by retesting the system to verify improved performance.
D. Propose that the application be moved to a server with a faster disk system that supports fault tolerance and retest the system to verify improved performance.less
解析:
某個Sharepoint系統出現了運行效率問題,尤爲是加載大量數據時就會顯得很慢。此Sharepoint包含了若干用戶開發的Web應用程序和第三方的Web Part控件,而且在運行時有以下現象:
現象1. 應用程序池頻繁的被回收
現象2. 客戶端運行反應很慢
現象3. 過多的頁面報錯
針對上述狀況,你須要分析並找出解決辦法。
從上述狀況描述也符合Sharepiont內存泄露的情形,若是看了Question101,你會很容易定位到選項A爲本題的正解。
選項B.設置Page File Size,它是虛擬內存的組成,對它的調整能夠影響基於.net架構程序的運行效率。但此參數與本題所描述的應用程序池的運行問題毫無關係。
選項C.設置應用程序池回收頻率不足以形成現象2與3的狀況,因此排除。
選項D.在較慢的硬盤上運行不足以形成過多的頁面報錯以及應用程序池頻率被回收的狀況,因此排除。
所以本題答案應該選 Aide
參考
http://msdn.microsoft.com/zh-cn/library/ee557362(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/ff647813.aspx
http://msdn.microsoft.com/zh-cn/library/aa720473(v=vs.71).aspxwordpress
Question 104
You are designing a SharePoint 2010 application. The code makes numerous calls to SPSite and SPWeb objects.The system and application performance is poor in the test environment. There is also a high level of memory use for IIS worker processes. You need to ensure that the application performance and high memory use issues are addressed. Which approach should you recommend?
A. Use the Resource Throttling settings in Central Administration to increase site resource thresholds.
B. Use the SPSite and SPWeb SharePoint 2010 Power Shell cmdlets.
C. Ensure that the Dispose method of SPSite and SPWeb is called throughout the code.
D. Ensure that the Close method of SPSite and SPWeb is called throughout the code.工具
解析:
你設計一個Sharepoint應用程序,在開發代碼中屢次調用了SPSite和SPWeb對象。當在開發環境中測試程序時發現它的運行效率很慢,並且你發現IIS工做進程對內存的佔用率很高。你須要找出形成這種現象的具體緣由。
若是看了Question101,這道題也很容易定位到選項C。
你可能對選項D存有疑問,爲何不能Close呢?咱們知道,Dispose與Close均可以用於釋放內存,但Close方法只能用在你先自行建立了SPSite對象,而後再去釋放它。若是你是引用(Reference)了一個SPSite對象,你就不能經過Close方法去釋放它。
因此咱們一般推薦使用Dispose方法來代替Close方法,由於在Dispose方法中最終仍是調用了Close方法,但它是經過IDisposable接口來實現的,因此.NET Framework的垃圾回收機制會調用 Dispose方法來釋放與此對象相關的內存。
至於選項A是用來限制返回過多結果集以防止對Sharepoint系統效率形成衝擊(如規定,List只能返回2500條記錄)。它與內存的泄露無關。因此排除。
選項B則更與本題描述無關了,使用Power Shell命令行工具來使用SPSite與SPWeb對象與本應用程序對SPSite和SPWeb對象的使用並由此形成的內存泄露毫無關係,因此也被排除。
所以本題答案應該選 C 測試
參考
http://msdn.microsoft.com/en-au/library/ee557362(v=office.14).aspx
http://jerryyasir.wordpress.com/2009/11/22/resource-throttling-in-sharepoint-2010/spa