Sharepoint学习笔记—习题系列--70-576习题解析 -(Q84-Q87)

Question  84
You are designing a Web Part for SharePoint 2010 that must be able to be used on any site in the farm. The Web Part will display data values updated from a Microsoft SQL Server database. Your design must:
.Verify the actual performance data of the Web Part on any page where it is used in the farm.
.Trace performance and latency through the SharePoint, .NET, and SQL Server layers of the Web Part execution process. Provide information that can be used to debug and troubleshoot all issues with page rendering time. You need to meet all the requirements and allow your developers to enable this capability on any page they need to test. Which approach should you recommend?
A. Build and deploy the Web Part as a sandboxed solution and set a daily quota for the Web Part. Monitor the Web Part memory utilization and adjust the appropriate Resource Measures property for the sandboxed solution.
B. Build and deploy the Web Part as a sandboxed solution and set an absolute limit quota for the Web Part. Monitor the Web Part performance and adjust the appropriate Resource Measures property programmatically using the SharePoint object model.
C. Build and deploy the Web Part hosted in each site that requires it. Set the developer dashboard to Off for the site. When testing performance, change the dashboard setting to On using a Power Shell script.
D. Build and deploy the Web Part hosted in the Central Administration site. Set the developer dashboard to On Demand in the farm. When testing performance, manually enable the dashboard on each Web page.


解析:
你需要设计一个可用在场内任何位置的Web Part,此Web Part用于显示来自SQL数据库的信息,且满足如下条件:
  要求1. 可以在场内的任何应用了此Web Part的页面上检验其执行效率
  要求2. 跟踪此Web Part在Sharepoint,.NET和SQL数据库层面上的执行效率和延迟情况,并为程序调试和诊断与页面呈现耗时相关的问题提供信息。  
程序开发人员可以根据需要自行决定是否启用上述功能。 你该采用哪种方案呢?
  首先,选项A.B采用了Sandbox解决方案, 并监视Sandbox解决方案上设置的配额消耗情况。而这种方式并不能跟踪到Web Part在Sharepoint、.NET和SQL数据库层面上的执行效率和延迟情况,并为程序调试和诊断与页面呈现耗时相关的问题提供信息。它仅是针对对分配给Sandbox解决方案的配额(如:CPUExcutionTime,CriticalExceptionCount,ProcessCPUCycles,ProcessIOBytes等资源或指标)进行监控,所以应该被排除。
  选项C.D涉及到开发人员面板(Developer Dashboard),我们先来看看其相关的知识点:
  开发人员面板是 Microsoft SharePoint Foundation 2010 中引入的仪表框架。此面板在概念上与 ASP.NET 页面跟踪类似,它提供了一些诊断信息,可帮助开发人员或系统管理员解决难以隔离的页面组件问题。例如,开发人员很容易无意地在其代码中引入额外的 SPSite 或 SPWeb 对象或添加外部 SQL Server 查询。
在过去,用于调试因代码中这些实例的额外开销所导致的性能问题的唯一方法是,将调试器附加到代码并监视 SQL Server Profiler 踪迹。利用开发人员面板,开发人员可通过编程方式(通过使用对象模型)或可视方式(通过查看页面输出)来识别此类问题。
  可以在以下模式中显示开发人员面板:
On:在 On 模式中启用面板时,可在使用默认母版页的所有页面上查看面板。
OnDemand:在将开发人员面板设置为 OnDemand 模式时,页面的右上方会显示一个图标。用户可使用该图标来启用和禁用面板。
  从上面的描述可以看出,选项C有存在的问题是:1.本题要求此Web Part适用于整个场,所以把本解决方案部署到Sharepiont管理中心更显合理。 2. 开发人员面板只有On和OnDemand两种状态值,没有选项C所提的Off状态值。3.本题显然使用OnDemand更合理,由使用者在相应的页面上灵活快捷地确定开启跟踪的时机,而用不着非得通过PowerShell来开启它。
  而选项D则更适合本题的要求。
  因此本题答案应该选 D

参考 
http://msdn.microsoft.com/zh-cn/magazine/ee335711.aspx
http://msdn.microsoft.com/zh-cn/library/ff512745(v=office.14).aspx
http://sharepointstudy.wordpress.com/2011/02/06/msdn-developing-deploying-and-monitoring-sandboxed-solutions-in-sharepoint-2010/


Question 85 
You are designing a SharePoint 2010 application. You have an Internet-facing site with numerous image and  movie files. You need to ensure that these files are cached so that they are displayed to users quickly. Which approach should you recommend?
A. In the SharePoint web.config file, set the cacheForEditRights property of the OutputCacheProfiles element to true.
B. In the SharePoint web.config file, set the enabled property of the Blob Cache element to true.
C. In Site Collection Administration, use Site Collection Cache Settings to configure the cache.
D. In Central Administration, use Search Administration to manage the cache.


解析:
  你需要在一个基于Sharepoint2010开发的公共网站上应用大量的图片和视频,为提高访问图片和视频的效率,你需要缓存这些资源文件,你应该采用哪种方式来达到此目的呢?
  根据Question83的描述,我们应该知道这属于 Microsoft SharePoint Server 2010 缓存选项中的二进制大型对象 (BLOB) 的基于磁盘的缓存类型。因为此类缓存就是用来控制对二进制大型对象 (BLOB)(如图像、声音、视频文件和代码片段)的缓存的。
使用基于磁盘的缓存可减少访问 BLOB 时所需的数据库往返行程次数。从数据库检索 BLOB 之后,BLOB 将会存储在 Web 服务器上。后续的请求都从基于磁盘的缓存提供,并根据安全性对这些请求进行修整。
  默认情况下,BLOB 缓存处于关闭状态,因此必须启用它才能使用它所提供的功能。如果在前端 Web 服务器上启用 BLOB 缓存,则将在 SharePoint Server 2010 数据库服务器上减少 Web 浏览器发出的读取请求所产生的负载。
您可以在要应用 BLOB 缓存的 Web 应用程序的 Web.config 文件中启用 BLOB 缓存。您对 Web.config 文件所做的更改将应用于 Web 应用程序内的所有网站集。在Web.config中找到如下一行:
 

<BlobCache location="<location>" path="<files to be cached>" maxSize="10" enabled="true" />

其属性含义如下:
 location 是将用于存储缓存文件的目录。
 path 以常规表达式的形式指定根据文件扩展名缓存哪些文件。
 maxSize 表示基于磁盘的缓存的最大允许大小(以 GB 为单位)。默认是10GB
 max-age 指定客户端浏览器缓存下载到客户端计算机的 BLOB 的最长时间(以秒为单位)。如果下载的项自上次下载后尚未过期,则当请求该页时,不会重新请求相同的项。默认情况下,max-age 属性设置为 86400 秒(即 24 个小时),但它可以设置为 0 或更长的时间段。
 enabled 为禁用或启用缓存的布尔值。

实例如下:

<BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="true" />

  从以上描述可以看出,选项B符合开启BLOB Cache的操作条件:1.通过Web.config文件开启. 2.通过属性enable开启。
因此本题答案应该选 B

参考 
http://technet.microsoft.com/zh-cn/library/cc261797(v=office.14).aspx#section3
http://technet.microsoft.com/zh-cn/library/ee424404(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/aa604896(v=office.14).aspx

 

Question 86 
You are consulting with a customer who has an Internet-facing SharePoint 2010 site. The SharePoint farm runs  across multiple servers. The customer needs to improve the user experience on the site by improving Web page load times. The site customization requires extensive resources, including large image files, custom CSS, and JavaScript files. You need to suggest a way to help improve the SharePoint site performance that does not require a hardware upgrade. What should you recommend that the customer do?
A. Configure the query servers in the farm as additional Web servers and verify that the object cache is enabled on all Internet-facing Web sites.
B. Reconfigure the Web servers to increase the size of their page files.
C. Enable disk-based caching on the Web servers for the Internet-facing Web site.
D. Create an additional Microsoft SQL Server database to store the configuration database that stores the data for the site.


解析:
  一个Sharepoint场内有多台服务器,上面开发部署了公网网站,为了加强公网用户的访问体验,需要提高页面的加载速度,此外还需要应用大量的图片,客户定制的CSS与Javascript文件。你需要考虑如何在无需硬件升级的前提下实现这个目标。
  下面我们来分析各选项:
  选项A. Configure the query servers in the farm as additional Web servers
    把一个Query服务器配置成WFE服务器以加强Web页面的请求处理。在实际操作中一般不会这么做,如果以牺牲Query能力来提高WFE服务能力在一定程度上是可以提高页面请求处理速度的。
and verify that the object cache is enabled on all Internet-facing Web sites.
  通过开启对象缓存来提高加载页面速度。我们知道,对象缓存的实施位置是:单个 Web 部件控件、字段控件和内容级别,包括跨列表查询缓存和导航缓存。本题涉及到了图片这类的大文件(including large image files, custom CSS, and JavaScript files),所以应该使用的是针对二进制大型对象 (BLOB) 的基于磁盘的缓存类型。
 
选项B. Reconfigure the Web servers to increase the size of their page files.
本选项的操作似乎是让问题更严重了,应该排除。

选项C. Enable disk-based caching on the Web servers for the Internet-facing Web site.
通过开启二进制大型对象 (BLOB) 的基于磁盘的缓存来满足本题的要求,基于磁盘的缓存可控制二进制大型对象 (BLOB)(如图像、声音和视频文件)的缓存。基于磁盘的缓存的速度非常快;因此不需要数据库往返。从数据库检索 BLOB 一次,然后将其存储在 Web 客户端上。将从缓存中为后续的请求提供服务并根据安全性对其进行修整。
 
选项D. Create an additional Microsoft SQL Server database to store the configuration database 
本选项另行存储配置数据库,与本题毫无关系,而且Sharepoint场的配置数据库, 它是维系Sharepoint场运行的关键数据库,它在安装Sharepoint时就已确定,一般不作更改。
因此本题答案应该选 C

参考 
http://msdn.microsoft.com/zh-cn/library/aa604896(v=office.14).aspx

 

Question 87 
You are planning a development environment to create custom solutions for a production SharePoint 2010 farm. The plan needs a software tool to help diagnose application bugs introduced through custom code and provide information about the page rendering time from the Web request to the database query. Developers need to isolate problems and diagnose excessive execution times in the following items:
.Page request
.SPRequest
.Microsoft SQL Server 2008
You need to recommend a way for developers to identify if a value exceeds acceptable ranges in the items listed in the requirements. What should you tell the developers to do?
A. Use the Object Explorer component of SQL Server Management Studio to configure the SQL Server Agent properties to Include execution trace messages.
B. Enable the developer dashboard for the development environment to display the required information on all pages.
C. Enable the Developer Tools in Microsoft Internet Explorer 8. Open the Script tab and click Start Debugging.
D. Enable the Developer Tools in Internet Explorer 8. Set up live editing of cascading style sheets (CSS) and click a property name, value, or selector. Then type a new value and press Enter.

解析:
  你负责创建一个基于Sharepoint2010场的开发环境。 此开发环境可以通过软件工具(此工具可通过用户代码引入)协助调试和诊错,并且可以提供从Web请求到数据查询等诸多层面的关于页面呈现时间的相关信息。开发人员需要对下面列举的条目进行问题隔离和执行超时诊断:
.Page request
.SPRequest
.Microsoft SQL Server 2008
   你需要为开发人员推荐采取哪种方法才能帮助他们辨别上述条目的某些值超过了既定范围,从而辅助其进行问题隔离和超时诊断。
   如果看了Question84,我们马上就能判断应该应用开发人员工作面板。
开发人员面板包含一个可扩展机制,用于在不同的范围下测量各种性能计数器。在开发人员面板内部,可使用以下性能计数器来监视请求的每个阶段的使用率和资源消耗。

  •  每线程计数器
  •  这些计数器可测量当前请求或计时器作业的值:
  •  线程执行时间
  •  数量、持续时间、调用堆栈信息和页面生成的每个 SQL Server 查询的查询文本
  •  数量、持续时间和每个 WCF 调用的调用堆栈信息
  •  URL 或计时器作业名称
  •  当前用户
  •  执行开始时间
  •  包含在 SPMonitoredScope 中的代码的前面的任意统计信息

   通过引入 SPMonitoredScope 类,开发人员可“包装”代码并在屏幕上显示该代码的使用统计信息。可使用此信息标识潜在的失败点或至少可标识未按预期执行的组件。
  所以选项B为本题答案。
  选项A.解决了关于SQL的有些问题,但解决不了Page Request与SPRequest等关于Sharepoin环境内的有关问题。
  选项C.设置关于调试Script的功能,但并没解决本题所要求的功能。
  选项D.是使用IE Developer进行页面上的编辑测试,也没解决本题的问题。
因此本题答案应该选 B

参考 
http://msdn.microsoft.com/zh-cn/library/ff512745(v=office.14).aspx
http://social.technet.microsoft.com/Forums/zh-CN/5cd10180-9ee6-4d7e-b2d0-1b568d75988f/sharepoint-2010-developer-dashboard
http://msdn.microsoft.com/en-us/library/ms173849(v=sql.100).aspx

 

posted @ 2013-10-21 13:02  wsdj  阅读(654)  评论(0编辑  收藏  举报