Sharepoint学习笔记—习题系列--70-576习题解析 -(Q102-Q104)
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.aspx
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.
解析:
某个Sharepoint系统出现了运行效率问题,尤其是加载大量数据时就会显得很慢。此Sharepoint包含了若干用户开发的Web应用程序和第三方的Web Part控件,并且在运行时有如下现象:
现象1. 应用程序池频繁的被回收
现象2. 客户端运行反应很慢
现象3. 过多的页面报错
针对上述情况,你需要分析并找出解决办法。
从上述情况描述也符合Sharepiont内存泄露的情形,如果看了Question101,你会很容易定位到选项A为本题的正解。
选项B.设置Page File Size,它是虚拟内存的组成,对它的调整可以影响基于.net架构程序的运行效率。但此参数与本题所描述的应用程序池的运行问题毫无关系。
选项C.设置应用程序池回收频率不足以造成现象2与3的情况,所以排除。
选项D.在较慢的硬盘上运行不足以造成过多的页面报错以及应用程序池频率被回收的情况,所以排除。
因此本题答案应该选 A
参考
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).aspx
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/
Sharepoint学习笔记—习题系列--70-576习题解析 -(Q102-Q104)的更多相关文章
- Sharepoint学习笔记—ECM系列—文档列表的Metedata Navigation与Key Filter功能的实现
如果一个文档列表中存放了成百上千的文档,想要快速的找到你想要的还真不是件容易的事,Sharepoint提供了Metedata Navigation与Key Filter功能可以帮助我们快速的过滤和定位 ...
- Sharepoint学习笔记—ECM系列--文档集(Document Set)的实现
文档集是 SharePoint Server 2010 中的一项新功能,它使组织能够管理单个可交付文档或工作产品(可包含多个文档或文件).文档集是特殊类型的文件夹,它合并了唯一的文档集属性以及文件夹和 ...
- Sharepoint学习笔记—习题系列--70-576习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-576习题解析 为便于查阅,这里整理并列出了70-576习题解析系列的所有问题,有些内容可能会在以后更新. 需要事先申明的是: 1. ...
- Sharepoint学习笔记—习题系列--70-573习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-573习题解析 为便于查阅,这里整理并列出了我前面播客中的关于70-573习题解析系列的所有问题,有些内容可能会在以后更新, ...
- Deep Learning(深度学习)学习笔记整理系列之(五)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(八)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(七)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(六)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(四)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(三)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
随机推荐
- [转]PHP的执行流程,PHP扩展加载过程
原文:http://www.imsiren.com/archives/535 为了以后能开发PHP扩展..就一定要了解PHP的执行顺序..这篇文章就是为C开发PHP扩展做铺垫. web环境 我们假设为 ...
- HighCharts从数据库中读取数据
1.index.js router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); ...
- 趣谈unicode,ansi,utf-8,unicode big endian这些编码有什么区别(转载)
从头讲讲编码的故事.那么就让我们找个草堆坐下,先抽口烟,看看夜晚天空上的银河,然后想一想要从哪里开始讲起.嗯,也许这样开始比较好…… 很久很久以前,有一群人,他们决定用8个可以开合的晶体管来组合成不同 ...
- PHP CURL CURLOPT参数说明(curl_setopt)
CURLOPT_RETURNTRANSFER 选项: curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 如果成功只将结果返回,不自动输出任何内容. 如果失败返回F ...
- chrome浏览器的跨域设置——包括版本49前后两种设置
做前后分离的webapp开发的时候,出于一些原因往往需要将浏览器设置成支持跨域的模式,好在chrome浏览器就是支持可跨域的设置,网上也有很多chrome跨域设置教程.但是新版本的chrome浏览器提 ...
- 小白Linux入门 四
http://edu.51cto.com/lesson/id-11372.html 28了 文件管理类命令 目录: mkdir mkdir /tmp/x mkdir -p /tmp/a/b -pv b ...
- Block知识点总结
block的作用 block用于保存一段代码 在适当的时候再使用 它是一种数据类型 block的定义格式: 返回值 (^block变量名)(形参列表) = ^(形参列表) { 需要执行的代码}; ...
- iOS 商品倒计时 限时特价 限时优惠 功能的封装
最近项目中多个页面用到了 商品特价倒计时的功能 为了偷懒 于是自己封装了一个限时抢购 倒计时的view 代码实现如下: 定向价 限时特价 模型代码实现: #pragma mark 商品定向价模型 @ ...
- 初识Spring
Spring简介 说到Spring就得提到它的作者"Rod Johnson",2002年他编写了<Expert One-on_One java EE设计与开发>一书.在 ...
- 用户反馈:对 Rafy 开发框架的一些个人建议
这篇文章是去年 Rafy 框架发布后,许胜平先生为我提出的一些建议.他从用户群体分析.社区.商业模式.技术支持等方面对框架发展提出了建议,我觉得写得非常不错.此文不仅适用于 Rafy 框架,所以不 ...