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 ...
随机推荐
- 看看国外的javascript题目,你能全部做对吗?
叶小钗 的博客最近都在讨论面试题目 正好以前也看过一篇,就借花献佛拿出来分享一下 http://perfectionkills.com/javascript-quiz/ 附带了自己的理解,答案有争议的 ...
- OpenCascade MeshVS Usage
OpenCascade MeshVS Usage eryar@163.com Abstract. MeshVS means Mesh Visualization Service. It can be ...
- 苹果系统安装虚拟机 Mac如何安装虚拟机教程
1.前言 大家在用 Mac 系统的时候,可能有时难免还是要用到 Windows 系统.在 Mac 上使用 Windows 系统有二种方法.一种是在 Mac上安装双系统,适合要在机器上处理一些大型 ...
- 坑爹的Maven
之前没用过Maven,最近在研究Curator的时候,导入别人的工程,但是没有相应的包,需使用Maven解决依赖.于是各种折腾,最后虽然解决了,但中间的坑还不少.尽管网上也有相应的安装教程,但很多都是 ...
- 【记录】JS 获取图片原始尺寸-防止图片溢出
示例代码: <div id="div_content"> <img src="http://static.cnblogs.com/images/logo ...
- spring @import和@importResource
@ImportResource in spring imports application xml in configuration file which is using @Configuratio ...
- 学习SpringMVC——如何获取请求参数
@RequestParam,你一定见过:@PathVariable,你肯定也知道:@QueryParam,你怎么会不晓得?!还有你熟悉的他(@CookieValue)!她(@ModelAndView) ...
- Cesium原理篇:6 Renderer模块(1: Buffer)
刚刚结束完地球切片的渲染调度后,打算介绍一下目前大家都很关注的3D Tiles方面的内容,但发现要讲3D Tiles,或者充分理解它,需要对DataSource,Primitive要有基础,而这要求对 ...
- PJAX初体验(主要是利用HTML5 新增API pushState和replaceState+AJAX)
说在前面 什么是PJAX呢? 站在应用角度的就是既实现了页面无刷新的效果,同时也产生了浏览器的前进和后退,而且url也会变化. 也不是什么新鲜技术,主要是AJAX+html5 pushState和re ...
- [Java 基础]数据类型
基本类型和引用类型 Java中的数据类型有两类: l 基本类型(又叫内置数据类型,或理解为值类型) l 引用类型 基本类型和引用类型的区别 1. 从概念方面来说 基本类型:变量名指向具体的数值 ...