{"id":251,"date":"2010-05-13T17:38:06","date_gmt":"2010-05-13T15:38:06","guid":{"rendered":"http:\/\/www.itidea.nl\/wordpress\/?p=251"},"modified":"2015-09-08T20:32:22","modified_gmt":"2015-09-08T18:32:22","slug":"sandboxed-solutions","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/sandboxed-solutions\/","title":{"rendered":"Sandboxed solutions"},"content":{"rendered":"<p>Sandboxed solutions are deployed to the database. This means that no files within the sandboxed solution will ever touch the file system of the server. Even dlls, xml files and aspx pages will be deployed to the database.<\/p>\n<p>In Central Administration ensure that the Microsoft SharePoint Foundation Sandboxed Code Service is running on every server in the Farm where sandboxed solutions will be deployed and running.<br \/>\nSandboxed solutions run within a special process, the Sandbox Worker Process (SPUCWorkerProcess.exe), part of this service.<\/p>\n<p>The visually difference between a sandboxed and a farm solution in Visual Studio 2010 are:<\/p>\n<ol>\n<li>the property Sandboxed Solution (Project properties): true for sandboxed, false for farm solution<\/li>\n<li>AssemblyInfo.cs: [assembly: AllowPartiallyTrustedCallers()] is present in a sandboxed solution, not in a farm solution.<\/li>\n<\/ol>\n<p>Sandboxed solution are wsp packages, deployed from solution gallery at site collection level by site collection administrators. The packages are isolated to site collection it is deployed to.<br \/>\nThe solution gallery also displays resources consumed today and average usage the last 14 days.<\/p>\n<p>When using sandboxed solutions a farm administrator can assign resource points to a site collection. The default quota is 300 points per day and points are calculated based on 14 different metrics:<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"937\">\n<tbody>\n<tr>\n<td width=\"246\" valign=\"top\"><strong>Resource<\/strong><\/td>\n<td width=\"263\" valign=\"top\"><strong>Description<\/strong><\/td>\n<td width=\"153\" valign=\"top\"><strong>Units<\/strong><\/td>\n<td width=\"158\" valign=\"top\"><strong>Resources per point<\/strong><\/td>\n<td width=\"115\" valign=\"top\"><strong>Limit<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">AbnormalProcessTerminationCount<\/td>\n<td width=\"263\" valign=\"top\">Abnormally terminated process<\/td>\n<td width=\"153\" valign=\"top\">count<\/td>\n<td width=\"158\" valign=\"top\">1<\/td>\n<td width=\"115\" valign=\"top\">1<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">CPUExecutionTime<\/td>\n<td width=\"263\" valign=\"top\">CPU Execution Time for site<\/td>\n<td width=\"153\" valign=\"top\">seconds<\/td>\n<td width=\"158\" valign=\"top\">3600<\/td>\n<td width=\"115\" valign=\"top\">60<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">CriticalExceptionCount<\/td>\n<td width=\"263\" valign=\"top\">Critical Exception Events<\/td>\n<td width=\"153\" valign=\"top\">Events<\/td>\n<td width=\"158\" valign=\"top\">10<\/td>\n<td width=\"115\" valign=\"top\">3<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">InvocationCount<\/td>\n<td width=\"263\" valign=\"top\">Solution Invocation Events<\/td>\n<td width=\"153\" valign=\"top\">Events<\/td>\n<td width=\"158\" valign=\"top\">&lt;TBD&gt;<\/td>\n<td width=\"115\" valign=\"top\">&lt;TBD&gt;<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">PercentProcessorTime<\/td>\n<td width=\"263\" valign=\"top\">% CPU usage by solution<\/td>\n<td width=\"153\" valign=\"top\">%<\/td>\n<td width=\"158\" valign=\"top\">85<\/td>\n<td width=\"115\" valign=\"top\">100<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">ProcessCPUCycles<\/td>\n<td width=\"263\" valign=\"top\">Solution CPU cycles<\/td>\n<td width=\"153\" valign=\"top\">cycles<\/td>\n<td width=\"158\" valign=\"top\">1&#215;10^11<\/td>\n<td width=\"115\" valign=\"top\">1&#215;10^11<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">ProcessHandleCount<\/td>\n<td width=\"263\" valign=\"top\">Windows handles count<\/td>\n<td width=\"153\" valign=\"top\">items<\/td>\n<td width=\"158\" valign=\"top\">10000<\/td>\n<td width=\"115\" valign=\"top\">10000<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">ProcessIOBytes<\/td>\n<td width=\"263\" valign=\"top\">Windows handles count<\/td>\n<td width=\"153\" valign=\"top\">items<\/td>\n<td width=\"158\" valign=\"top\">0<\/td>\n<td width=\"115\" valign=\"top\">1&#215;10^8<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">ProcessThreadCount<\/td>\n<td width=\"263\" valign=\"top\">Thread count in overall process<\/td>\n<td width=\"153\" valign=\"top\">Thread instances<\/td>\n<td width=\"158\" valign=\"top\">10000<\/td>\n<td width=\"115\" valign=\"top\">200<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">ProcessVirtualBytes<\/td>\n<td width=\"263\" valign=\"top\">Memory consumed<\/td>\n<td width=\"153\" valign=\"top\">Bytes<\/td>\n<td width=\"158\" valign=\"top\">0<\/td>\n<td width=\"115\" valign=\"top\">1&#215;10^9<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">SharePointDatabaseQueryCount<\/td>\n<td width=\"263\" valign=\"top\">Number of SharePoint database queries<\/td>\n<td width=\"153\" valign=\"top\">Query instances<\/td>\n<td width=\"158\" valign=\"top\">20<\/td>\n<td width=\"115\" valign=\"top\">100<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">SharePointDatabaseQueryTime<\/td>\n<td width=\"263\" valign=\"top\">Elapsed time to execute query<\/td>\n<td width=\"153\" valign=\"top\">seconds<\/td>\n<td width=\"158\" valign=\"top\">120<\/td>\n<td width=\"115\" valign=\"top\">60<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">UnhandledExceptionCount<\/td>\n<td width=\"263\" valign=\"top\">Number of unhandled exceptions<\/td>\n<td width=\"153\" valign=\"top\">Unhandled exception instances<\/td>\n<td width=\"158\" valign=\"top\">50<\/td>\n<td width=\"115\" valign=\"top\">3<\/td>\n<\/tr>\n<tr>\n<td width=\"246\" valign=\"top\">UnresponsiveProcessCount<\/td>\n<td width=\"263\" valign=\"top\">Number of unresponsive processes<\/td>\n<td width=\"153\" valign=\"top\">Unresponsive process instances<\/td>\n<td width=\"158\" valign=\"top\">2<\/td>\n<td width=\"115\" valign=\"top\">1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>These metrics were chosen because they impact the health and stability of the server. The use of resources that have a higher impact on the server will cost you more points.<br \/>\nWhen the sandboxed solutions in a site collection use more than the assigned amount of points in a single day the sandboxed solutions in that particular site collection are shut down by SharePoint. This means that end users won\u2019t be able to use the functionality of any sandboxed solution in that specific site collection until the resource points are reset. The following message will be displayed to the user:<br \/>\n<a href=\"file:\/\/\/C:\/Users\/A.T.J.%20Boerboom\/AppData\/Local\/Temp\/WindowsLiveWriter1286139640\/supfiles115B511\/image16.png\"><\/a>\u00a0<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/ExceededResourceUsageQuota.png\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"45\" class=\"alignnone size-full wp-image-252\" title=\"ExceededResourceUsageQuota\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/ExceededResourceUsageQuota.png\" alt=\"ExceededResourceUsageQuota\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/ExceededResourceUsageQuota.png 674w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/ExceededResourceUsageQuota-300x20.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/a><\/p>\n<p>The quota is per day, so after 24 hours the site collection will be unlocked and sandboxed solutions in that site collection can be used again. These 24 hours can be adjusted because this is a timerjob default scheduled every 24 hours: Solution Daily Usage Update.<\/p>\n<p>Some important notes:<\/p>\n<ul>\n<li>resource quota\u2019s can be exceeded through high usage and can be an indicator of poorly written code e.g. the UnhandledExceptionCount, but this isn\u2019t necessarily an indicator e.g. SharePointDatabaseQueryCount.<\/li>\n<li>resource quota\u2019s can be exceeded for a period of time, because the resource usage is calculated by timerjobs, these have to run first to update the resource usage calculation.<\/li>\n<li>resource quota\u2019s can be adjusted. You can define a new quota template (CA, App man, Specify Quota Templates, Create a new quota template and connect this template to a site collection: CA, App man, Configure quota\u2019s and locks, select the site collection and the quota template to use) with other settings of maximum points, but this will impact the health and stability of the server.<\/li>\n<li>sandbox code will not be terminated mid-execution.<\/li>\n<\/ul>\n<p>Timerjobs involved (for every web application):<\/p>\n<ul>\n<li>Solution Daily Usage Update (Marks the daily boundary for sandboxed solution resource quota monitoring, every day)<\/li>\n<li>Solution Resource Usage Log Processing (Aggregates resource usage data from sandboxed solution execution, every 5 minutes)<\/li>\n<li>Solution Resource Usage Update (Records resource usage data from sandboxed solution execution, and sends email to owners of site collections that are exceeding their allotted resource quota, every 15 minutes)<\/li>\n<\/ul>\n<p>The Solution Gallery displays an overview of the solutions with status (activated or not) and the used resources per solution:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/SolutionGalleryResourceUsage.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-367\" title=\"SolutionGalleryResourceUsage\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/05\/SolutionGalleryResourceUsage-e1274004303911.png\" alt=\"SolutionGalleryResourceUsage\" width=\"850\" height=\"116\" \/><\/a><\/p>\n<p>Unfortunately there is no drill down on this overview, so you can&#8217;t see which resource is heavily used in a particular solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sandboxed solutions are deployed to the database. This means that no files within the sandboxed solution will ever touch the file system of the server. Even dlls, xml files and aspx pages will be deployed to the database. In Central &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/sandboxed-solutions\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[25,42,6],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-sandboxed-solutions","tag-sharepoint-2010","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":12,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":255,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions\/255"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}