SlideShare a Scribd company logo
1 of 34
Download to read offline
Best practices with development of enterprise-scale SharePoint solutions 
PAOLO PIALORSI, PIASYS.COM 
paolo@pialorsi.com -@PaoloPia
About Me 
•Project Manager, Consultant, Trainer 
•More than 40 Microsoft certification exams passed, including MC(S)M 
•Focused on SharePoint since 2002 
•Author of 10 books about XML, SOAP, .NET, LINQ, and SharePoint 
•Speaker at main IT conferences worldwide 
•http://www.piasys.com/
Agenda 
•What’s an enterprise-scale solution? 
•Best Practices for … 
•Server-side code 
•Workflows 
•Public Facing Web Sites
What’s an enterprise-scale solution?
What makes a solution enterprise-scale? 
•Some technical numbers that matter 
•Number of concurrent users 
•Number of transactions x day 
•Some technical facts that matter, as well 
•Business continuity requirements 
•Scalability requirements 
•Etc. 
•Some other facts that still matter 
•Overall size of the customer 
•Network and infrastructure topology 
•Overall complexity of the solution 
•Number of use cases to support 
•Team Project size 
•Etc. 
Determine Overall Throughput
How to calculate Throughput 
•Throughput= numberof operationsper second(RPS) 
•Input Variables 
•Total Number of Users 
•Concurrency Rate (%) 
•Request Rate 
•Easy Output 
•Total Number of Users * Concurrency Rate / Request Rate 
•More Realistic and Complex Output 
•Based on usage clusters 
•And on concurrency peak 
Cluster 
Req/Hour 
Distribution 
Light 
20 
10% 
Typical 
36 
70% 
Heavy 
60 
15% 
Extreme 
120 
5%
Let’s make an example! 
•Input Variables 
•Total Number of Users: 10.000 
•Concurrency Rate (%): 10% 
•Request Rate: 36/hour = 1 every 100 seconds 
•Easy Output 
•10.000 * 10% / 100 = 10 RPS 
•Complex Output 
•Usage Peak: 33% 
•42.200 / 3600 = 11,72 RPS 
•Realistic Throughput = 3,87 RPS 
Cluster 
Req/Hour 
Distribution 
# Users 
# Req/Hour 
Light 
20 
10% 
1.000 
2.000 
Typical 
36 
70% 
7.500 
25.200 
Heavy 
60 
15% 
1.500 
9.000 
Extreme 
120 
5% 
500 
6.000 
42.200
THE BIGGEST IS THE THROUGHPUT, THE MORE YOU HAVE TO TAKE CARE OF QUALITY OF CODE … BUT YOU SHOULD ALWAYS TAKE CARE OF IT!
Our scope in this session 
•Here we focus on top best practices for enterprise-scale solutions 
•What kind of best practices? 
•Better Performances 
•Better Scalability 
•High Availability and Business Continuity 
•Stability of Code 
•Security of Code 
•What kind of solutions are we thinking about? 
•Custom Development Solutions 
•Custom Workflow Solutions 
•Public Facing Web Sites 
“Server-side” solutions
Let’s see the top 15 rules!
Rule #1: Properly Dispose unmanaged data 
•Remember to properly release unmanaged resources that you have created 
•Leverage the using keyword in that case 
•Avoid releasing unmanaged resources that you did not created 
•If you don’t adhere to this rule 
•Your code will be unstable 
•Sooner or later you will crash the hosting app pool 
•Because of memory leaks … performances could degrade, as well 
•Use SPDisposeCheckand/or SPCAF 
•Rule applies to: SPSite, SPWeb, SPLimitedWebPartManager, etc.
PROPERLY DISPONING UNMANAGED RESOURCES
Rule #2: Create SPWeb/SPSiteonly if needed 
•Don’t create SPWeb/SPSiteobjects too much freely 
•Create them only in case of real need 
•Otherwise leverage SPContext/SPControl 
•This will keep memory lighter and will be less error prone (mind Dispose) 
•If you don’t adhere to this rule 
•Memory allocation will increase uselessly 
•Performances will degrade 
•Code will not scale properly
Rule #3: Request only the data that you need 
•Don’t ever iterate over full SPListItemCollectionof a list/library 
•Always query items using a specific view or a CAML query 
•Remember to page data, instead of queringthe full resultset 
•If you don’t adhere to this rule 
•Performances will be bad and sad 
•Mainly in production, with huge numbers of users/items/documents/requests 
•Code will not scale properly 
•When the size of data grows … the performances decrease
QUERYING DATA WITH CAMLTHE RIGHT WAY
Rule #4: Don’t abuse of LINQ to SharePoint 
•Instead of LINQ to SharePoint queries 
•Which let you pay for the LINQ QueryProviderwork, under the cover 
•Prefer well-defined CAML queries with paging 
•Avoid two-stage queries in LINQ to SharePoint 
•Involve superset queries through CAML + LINQ to Objects in memory 
•For read-only LINQ to SharePoint queries 
•Use view projections and turn off ObjectTracking 
•Eventually simply use LINQ to SharePoint to discover CAML queries 
•If you don’t adhere to this rule 
•Your code will be slower than expected 
•Code will not scale properly 
•Solution ALM will be painful from a maintenance perspective
Rule #5: Handle exceptions properly 
•Catch and handle only those exceptions that you anticipate and can manage 
•Avoid simply catching all exceptions using a catch all block or an empty catch block 
•Always log exceptions and issues in the ULS log, for centralized management 
•If you don’t adhere to this rule 
•Your code will be unstable 
•The behavior of your solutions will be unpredictable
PROPERLY HANDLING EXCEPTIONS
Rule #6: SharePoint isn’t a DBMS! 
•Avoid using SharePoint as a DBMS replacement! 
•SharePoint isn’t a transactional resource manager 
•SharePoint cannot participate in distributed transactions 
•Or at least cannot do that with consciousness … 
•Consider using a polyglot system (SharePoint + DBMS + noSQL) 
•Handle with care data persistence and data integrity 
•Make your choice based on what you need to persist 
•If you don’t adhere to this rule 
•Sooner or later your solution will fail to keep data integrity 
•Your code will be potentially unstable 
•The behavior of your solutions will be unpredictable
MANAGING A POLYGLOT SYSTEMS, WHICHINCLUDES SHAREPOINT
Rule #7: Mind throttling rules 
•Keep in mind the list view threshold settings 
•5.000 items for regular users 
•10.000 items for site administrators 
•Daily time window for overriding 
•Unlimited for Local Administrators in local/remote server session 
•Overridablethrough Object Model 
•But it is not a good idea to exceed limits! 
•Restrict the scope of any overriding to the minimum 
•ConsiderList ViewLookupThreshold, aswell 
•Partition data results through custom views 
•Use indexed columns to avoid full table scan 
•Impacts on large workflow solutions (history list and task list)
MANAGING THROTTLING OVERRIDES
Rule #8: Avoid too many item-level permissions 
•Assign permissions at the highest possible level 
•Break permission inheritance as infrequently as possible 
•Don’t create tons of items with item-level permissions 
•Prefer folders to group items and their security rules via groups membership 
•In SharePoint 2013 continuous crawl mitigates security trimming issues 
•For lists of items (!documents) use ReadSecurity and WriteSecurity permission levels
Rule #9: Avoid “elevated” code via SPSecurity 
•SPSecurity.RunWithElevatedPrivilegesis generally speaking a “bad idea” 
•Consider changing the implementation 
•Or at least impersonate “minimal” principals using 
•SPSite(*, SPUserToken) constructor 
•If you don’t adhere to this rule 
•You could have potential security issues 
•Your code could be unsafe for the target farm
Rule #10: Properly use AllowUnsafeUpdates 
•Avoid using AllowUnsafeUpdatesas much as you can 
•And use it properly in case you really need it 
•Remember to use a try … finally block of code to reset it 
•Especially when you share SPWebwith others 
•Remember to put FormDigestin your custom pages 
•And manage update/delete/insert actions via POST 
•Avoid update/delete/insert actions via GET, as much as you can
WRITING SAFE AND SECURE CODE IN SHAREPOINT
Rule #11: Mind workflow numbers 
•Keep in mind List View Threshold and Trottlingfor history and tasks lists 
•Be careful with item level permissions, as already stated 
•Dependanttasks and task-level permissions are not supported out of the box by the Workflow Manager tools 
•You have to manually create custom actions for that
Rule #12: Caching, caching, caching! 
•Avoid useless network roundtrips 
•Keep in cache frequently accessed and rarely changing data 
•SharePoint Objects 
•Lookup data 
•Images, blob files, etc. 
•Out of the box there are 
•Object Cache 
•Output Cache 
•BLOB Cache 
•Use them to improve performances and response time 
•In particular in Public Facing Web Sites, but not only
Rule #13: Try to always use CQWP/CSWP 
•In Public Facing Web Sites always try to use 
•Content by Query Web Part 
•Content by Search Web Part 
•These web parts do a good caching of results 
•Thus, improving the overall perceived time 
•You only have to focus on XSLT or HTML Templates 
•Fallback to DataFormWebPartor XsltWebPart 
•Lastly, if you can’t avoid it, fallback to custom a WebPart
Rule #14: Don’t use Session or in-memory data 
•Avoid storing sessions or in-memory data on a single server 
•It wouldn’t scale across multiple servers 
•Only cached data that can stay in-memory of a single server 
•If you don’t adhere to this rule 
•The solutions will not scale horizontally 
•You will have to configure NLB affinity (very bad idea!) 
•The overall availability of the solutions will be reduced
Rule #15: Avoid single points of failure 
•Create code ready to be executed on multiple servers 
•Avoid relying on web.configor app.configdirectly 
•Avoid looking for specific files on the file system 
•Use only shared resources accessed through a provider 
•To abstract from the physical location of data/content 
•Mind data concurrency across multiple servers 
•Provide concurrency checks and optimistic concurrency 
•If you don’t adhere to this rule 
•Your solution will not scale 
•You will have to activate affinity, which will impact availability, as well
questions? 
HTTP://WWW.SHAREPOINT-REFERENCE.COM/BLOG/ 
@PAOLOPIA
thank you. 
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 
ZAGREB, 10/14/2014 -10/15/2014

More Related Content

Viewers also liked

Karine bosch andy-van_steenbergen-caml-spsbe12
Karine bosch andy-van_steenbergen-caml-spsbe12Karine bosch andy-van_steenbergen-caml-spsbe12
Karine bosch andy-van_steenbergen-caml-spsbe12BIWUG
 
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...SPC Adriatics
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentPranav Sharma
 
Biwug 25092012 sp2013_itpro_hans_jaspers
Biwug 25092012 sp2013_itpro_hans_jaspersBiwug 25092012 sp2013_itpro_hans_jaspers
Biwug 25092012 sp2013_itpro_hans_jaspersBIWUG
 
Best Practices for SharePoint Development Customization
Best Practices for SharePoint Development CustomizationBest Practices for SharePoint Development Customization
Best Practices for SharePoint Development CustomizationRicardo Wilkins
 
Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0LiquidHub
 
Best Practices to SharePoint Physical and Information Architecture
Best Practices to SharePoint Physical and Information ArchitectureBest Practices to SharePoint Physical and Information Architecture
Best Practices to SharePoint Physical and Information ArchitectureJoel Oleson
 
Best Practice SharePoint Architecture
Best Practice SharePoint ArchitectureBest Practice SharePoint Architecture
Best Practice SharePoint ArchitectureMichael Noel
 

Viewers also liked (9)

Karine bosch andy-van_steenbergen-caml-spsbe12
Karine bosch andy-van_steenbergen-caml-spsbe12Karine bosch andy-van_steenbergen-caml-spsbe12
Karine bosch andy-van_steenbergen-caml-spsbe12
 
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...
How To Successfully Deliver Your SharePoint Project In Ten Easy Steps - Symon...
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
 
Biwug 25092012 sp2013_itpro_hans_jaspers
Biwug 25092012 sp2013_itpro_hans_jaspersBiwug 25092012 sp2013_itpro_hans_jaspers
Biwug 25092012 sp2013_itpro_hans_jaspers
 
Best Practices for SharePoint Development Customization
Best Practices for SharePoint Development CustomizationBest Practices for SharePoint Development Customization
Best Practices for SharePoint Development Customization
 
Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0
 
Best Practices to SharePoint Physical and Information Architecture
Best Practices to SharePoint Physical and Information ArchitectureBest Practices to SharePoint Physical and Information Architecture
Best Practices to SharePoint Physical and Information Architecture
 
Best Practice SharePoint Architecture
Best Practice SharePoint ArchitectureBest Practice SharePoint Architecture
Best Practice SharePoint Architecture
 
SharePoint Programming Basic
SharePoint Programming BasicSharePoint Programming Basic
SharePoint Programming Basic
 

Similar to Best practices with development of enterprise-scale SharePoint solutions - Paolo Pialorsi

Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users Happy
Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users HappyGeek Sync | Top 5 Tips to Keep Always On Always Humming and Users Happy
Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users HappyIDERA Software
 
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas Suravarapu
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas SuravarapuGraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas Suravarapu
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas SuravarapuNeo4j
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL DevelopersIke Ellis
 
SharePoint TechCon 2009 - 803
SharePoint TechCon 2009 - 803SharePoint TechCon 2009 - 803
SharePoint TechCon 2009 - 803Andreas Grabner
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLTriNimbus
 
15 tips for bullet proof requirements analysis on SharePoint projects
15 tips for bullet proof requirements analysis on SharePoint projects15 tips for bullet proof requirements analysis on SharePoint projects
15 tips for bullet proof requirements analysis on SharePoint projectsDocFluix, LLC
 
Lifecycle Management with SharePoint Apps and Solutions
Lifecycle Management with SharePoint Apps and SolutionsLifecycle Management with SharePoint Apps and Solutions
Lifecycle Management with SharePoint Apps and SolutionsSPC Adriatics
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxJasonTuran2
 
Ideas spracklen-final
Ideas spracklen-finalIdeas spracklen-final
Ideas spracklen-finalsupportlogic
 
50 Shades of Fail KScope16
50 Shades of Fail KScope1650 Shades of Fail KScope16
50 Shades of Fail KScope16Christian Berg
 
The Technical Co-Founders Handbook
The Technical Co-Founders HandbookThe Technical Co-Founders Handbook
The Technical Co-Founders HandbookJoseph K. Ziegler
 
Putting Kafka Into Overdrive
Putting Kafka Into OverdrivePutting Kafka Into Overdrive
Putting Kafka Into OverdriveTodd Palino
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applicationsTalbott Crowell
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Lari Hotari
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...BIWUG
 
Cloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong CodeaholicsCloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong CodeaholicsTaswar Bhatti
 
Getting started developing for share point
Getting started developing for share pointGetting started developing for share point
Getting started developing for share pointRoel Bethlehem
 
5 physical data modeling blunders 09092010
5 physical data modeling blunders 090920105 physical data modeling blunders 09092010
5 physical data modeling blunders 09092010ERwin Modeling
 

Similar to Best practices with development of enterprise-scale SharePoint solutions - Paolo Pialorsi (20)

Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users Happy
Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users HappyGeek Sync | Top 5 Tips to Keep Always On Always Humming and Users Happy
Geek Sync | Top 5 Tips to Keep Always On Always Humming and Users Happy
 
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas Suravarapu
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas SuravarapuGraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas Suravarapu
GraphConnect Europe 2016 - Faster Lap Times with Neo4j - Srinivas Suravarapu
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL Developers
 
SharePoint TechCon 2009 - 803
SharePoint TechCon 2009 - 803SharePoint TechCon 2009 - 803
SharePoint TechCon 2009 - 803
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
 
15 tips for bullet proof requirements analysis on SharePoint projects
15 tips for bullet proof requirements analysis on SharePoint projects15 tips for bullet proof requirements analysis on SharePoint projects
15 tips for bullet proof requirements analysis on SharePoint projects
 
Lifecycle Management with SharePoint Apps and Solutions
Lifecycle Management with SharePoint Apps and SolutionsLifecycle Management with SharePoint Apps and Solutions
Lifecycle Management with SharePoint Apps and Solutions
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
 
Top 7 mistakes
Top 7 mistakesTop 7 mistakes
Top 7 mistakes
 
Ideas spracklen-final
Ideas spracklen-finalIdeas spracklen-final
Ideas spracklen-final
 
50 Shades of Fail KScope16
50 Shades of Fail KScope1650 Shades of Fail KScope16
50 Shades of Fail KScope16
 
The Technical Co-Founders Handbook
The Technical Co-Founders HandbookThe Technical Co-Founders Handbook
The Technical Co-Founders Handbook
 
Software development fundamentals
Software development fundamentalsSoftware development fundamentals
Software development fundamentals
 
Putting Kafka Into Overdrive
Putting Kafka Into OverdrivePutting Kafka Into Overdrive
Putting Kafka Into Overdrive
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applications
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
 
Cloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong CodeaholicsCloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong Codeaholics
 
Getting started developing for share point
Getting started developing for share pointGetting started developing for share point
Getting started developing for share point
 
5 physical data modeling blunders 09092010
5 physical data modeling blunders 090920105 physical data modeling blunders 09092010
5 physical data modeling blunders 09092010
 

More from SPC Adriatics

How to secure your data in Office 365
How to secure your data in Office 365 How to secure your data in Office 365
How to secure your data in Office 365 SPC Adriatics
 
Do you know, where your sensitive data is?
Do you know, where your sensitive data is?Do you know, where your sensitive data is?
Do you know, where your sensitive data is?SPC Adriatics
 
Securing Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSecuring Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSPC Adriatics
 
Creating Workflows in Project Online
Creating Workflows in Project OnlineCreating Workflows in Project Online
Creating Workflows in Project OnlineSPC Adriatics
 
Faster than a flash behind the scenes of patching SharePoint Online
Faster than a flash   behind the scenes of patching SharePoint OnlineFaster than a flash   behind the scenes of patching SharePoint Online
Faster than a flash behind the scenes of patching SharePoint OnlineSPC Adriatics
 
Role based views in Project and Resource Center
Role based views in Project and Resource CenterRole based views in Project and Resource Center
Role based views in Project and Resource CenterSPC Adriatics
 
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)SPC Adriatics
 
SharePoint Governance and Compliance
SharePoint Governance and ComplianceSharePoint Governance and Compliance
SharePoint Governance and ComplianceSPC Adriatics
 
From analyses to successful Implementation
From analyses to successful ImplementationFrom analyses to successful Implementation
From analyses to successful ImplementationSPC Adriatics
 
The key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionThe key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionSPC Adriatics
 
10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise SearchSPC Adriatics
 
How the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliveryHow the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliverySPC Adriatics
 
Scaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsScaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsSPC Adriatics
 
SharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSPC Adriatics
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...SPC Adriatics
 
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleCustom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleSPC Adriatics
 
SharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSPC Adriatics
 
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?SPC Adriatics
 
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016SPC Adriatics
 

More from SPC Adriatics (20)

How to secure your data in Office 365
How to secure your data in Office 365 How to secure your data in Office 365
How to secure your data in Office 365
 
Do you know, where your sensitive data is?
Do you know, where your sensitive data is?Do you know, where your sensitive data is?
Do you know, where your sensitive data is?
 
Securing Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSecuring Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management Services
 
Creating Workflows in Project Online
Creating Workflows in Project OnlineCreating Workflows in Project Online
Creating Workflows in Project Online
 
Faster than a flash behind the scenes of patching SharePoint Online
Faster than a flash   behind the scenes of patching SharePoint OnlineFaster than a flash   behind the scenes of patching SharePoint Online
Faster than a flash behind the scenes of patching SharePoint Online
 
Role based views in Project and Resource Center
Role based views in Project and Resource CenterRole based views in Project and Resource Center
Role based views in Project and Resource Center
 
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
 
SharePoint Governance and Compliance
SharePoint Governance and ComplianceSharePoint Governance and Compliance
SharePoint Governance and Compliance
 
From analyses to successful Implementation
From analyses to successful ImplementationFrom analyses to successful Implementation
From analyses to successful Implementation
 
The key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionThe key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoption
 
Office 365 Video
Office 365 VideoOffice 365 Video
Office 365 Video
 
10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search
 
How the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliveryHow the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and Delivery
 
Scaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsScaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other Tools
 
SharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSharePoint 2013 Search Operations
SharePoint 2013 Search Operations
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...
 
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleCustom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
 
SharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside Out
 
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
 
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
 

Best practices with development of enterprise-scale SharePoint solutions - Paolo Pialorsi

  • 1. Best practices with development of enterprise-scale SharePoint solutions PAOLO PIALORSI, PIASYS.COM paolo@pialorsi.com -@PaoloPia
  • 2.
  • 3. About Me •Project Manager, Consultant, Trainer •More than 40 Microsoft certification exams passed, including MC(S)M •Focused on SharePoint since 2002 •Author of 10 books about XML, SOAP, .NET, LINQ, and SharePoint •Speaker at main IT conferences worldwide •http://www.piasys.com/
  • 4. Agenda •What’s an enterprise-scale solution? •Best Practices for … •Server-side code •Workflows •Public Facing Web Sites
  • 6. What makes a solution enterprise-scale? •Some technical numbers that matter •Number of concurrent users •Number of transactions x day •Some technical facts that matter, as well •Business continuity requirements •Scalability requirements •Etc. •Some other facts that still matter •Overall size of the customer •Network and infrastructure topology •Overall complexity of the solution •Number of use cases to support •Team Project size •Etc. Determine Overall Throughput
  • 7. How to calculate Throughput •Throughput= numberof operationsper second(RPS) •Input Variables •Total Number of Users •Concurrency Rate (%) •Request Rate •Easy Output •Total Number of Users * Concurrency Rate / Request Rate •More Realistic and Complex Output •Based on usage clusters •And on concurrency peak Cluster Req/Hour Distribution Light 20 10% Typical 36 70% Heavy 60 15% Extreme 120 5%
  • 8. Let’s make an example! •Input Variables •Total Number of Users: 10.000 •Concurrency Rate (%): 10% •Request Rate: 36/hour = 1 every 100 seconds •Easy Output •10.000 * 10% / 100 = 10 RPS •Complex Output •Usage Peak: 33% •42.200 / 3600 = 11,72 RPS •Realistic Throughput = 3,87 RPS Cluster Req/Hour Distribution # Users # Req/Hour Light 20 10% 1.000 2.000 Typical 36 70% 7.500 25.200 Heavy 60 15% 1.500 9.000 Extreme 120 5% 500 6.000 42.200
  • 9. THE BIGGEST IS THE THROUGHPUT, THE MORE YOU HAVE TO TAKE CARE OF QUALITY OF CODE … BUT YOU SHOULD ALWAYS TAKE CARE OF IT!
  • 10. Our scope in this session •Here we focus on top best practices for enterprise-scale solutions •What kind of best practices? •Better Performances •Better Scalability •High Availability and Business Continuity •Stability of Code •Security of Code •What kind of solutions are we thinking about? •Custom Development Solutions •Custom Workflow Solutions •Public Facing Web Sites “Server-side” solutions
  • 11. Let’s see the top 15 rules!
  • 12. Rule #1: Properly Dispose unmanaged data •Remember to properly release unmanaged resources that you have created •Leverage the using keyword in that case •Avoid releasing unmanaged resources that you did not created •If you don’t adhere to this rule •Your code will be unstable •Sooner or later you will crash the hosting app pool •Because of memory leaks … performances could degrade, as well •Use SPDisposeCheckand/or SPCAF •Rule applies to: SPSite, SPWeb, SPLimitedWebPartManager, etc.
  • 14. Rule #2: Create SPWeb/SPSiteonly if needed •Don’t create SPWeb/SPSiteobjects too much freely •Create them only in case of real need •Otherwise leverage SPContext/SPControl •This will keep memory lighter and will be less error prone (mind Dispose) •If you don’t adhere to this rule •Memory allocation will increase uselessly •Performances will degrade •Code will not scale properly
  • 15. Rule #3: Request only the data that you need •Don’t ever iterate over full SPListItemCollectionof a list/library •Always query items using a specific view or a CAML query •Remember to page data, instead of queringthe full resultset •If you don’t adhere to this rule •Performances will be bad and sad •Mainly in production, with huge numbers of users/items/documents/requests •Code will not scale properly •When the size of data grows … the performances decrease
  • 16. QUERYING DATA WITH CAMLTHE RIGHT WAY
  • 17. Rule #4: Don’t abuse of LINQ to SharePoint •Instead of LINQ to SharePoint queries •Which let you pay for the LINQ QueryProviderwork, under the cover •Prefer well-defined CAML queries with paging •Avoid two-stage queries in LINQ to SharePoint •Involve superset queries through CAML + LINQ to Objects in memory •For read-only LINQ to SharePoint queries •Use view projections and turn off ObjectTracking •Eventually simply use LINQ to SharePoint to discover CAML queries •If you don’t adhere to this rule •Your code will be slower than expected •Code will not scale properly •Solution ALM will be painful from a maintenance perspective
  • 18. Rule #5: Handle exceptions properly •Catch and handle only those exceptions that you anticipate and can manage •Avoid simply catching all exceptions using a catch all block or an empty catch block •Always log exceptions and issues in the ULS log, for centralized management •If you don’t adhere to this rule •Your code will be unstable •The behavior of your solutions will be unpredictable
  • 20. Rule #6: SharePoint isn’t a DBMS! •Avoid using SharePoint as a DBMS replacement! •SharePoint isn’t a transactional resource manager •SharePoint cannot participate in distributed transactions •Or at least cannot do that with consciousness … •Consider using a polyglot system (SharePoint + DBMS + noSQL) •Handle with care data persistence and data integrity •Make your choice based on what you need to persist •If you don’t adhere to this rule •Sooner or later your solution will fail to keep data integrity •Your code will be potentially unstable •The behavior of your solutions will be unpredictable
  • 21. MANAGING A POLYGLOT SYSTEMS, WHICHINCLUDES SHAREPOINT
  • 22. Rule #7: Mind throttling rules •Keep in mind the list view threshold settings •5.000 items for regular users •10.000 items for site administrators •Daily time window for overriding •Unlimited for Local Administrators in local/remote server session •Overridablethrough Object Model •But it is not a good idea to exceed limits! •Restrict the scope of any overriding to the minimum •ConsiderList ViewLookupThreshold, aswell •Partition data results through custom views •Use indexed columns to avoid full table scan •Impacts on large workflow solutions (history list and task list)
  • 24. Rule #8: Avoid too many item-level permissions •Assign permissions at the highest possible level •Break permission inheritance as infrequently as possible •Don’t create tons of items with item-level permissions •Prefer folders to group items and their security rules via groups membership •In SharePoint 2013 continuous crawl mitigates security trimming issues •For lists of items (!documents) use ReadSecurity and WriteSecurity permission levels
  • 25. Rule #9: Avoid “elevated” code via SPSecurity •SPSecurity.RunWithElevatedPrivilegesis generally speaking a “bad idea” •Consider changing the implementation •Or at least impersonate “minimal” principals using •SPSite(*, SPUserToken) constructor •If you don’t adhere to this rule •You could have potential security issues •Your code could be unsafe for the target farm
  • 26. Rule #10: Properly use AllowUnsafeUpdates •Avoid using AllowUnsafeUpdatesas much as you can •And use it properly in case you really need it •Remember to use a try … finally block of code to reset it •Especially when you share SPWebwith others •Remember to put FormDigestin your custom pages •And manage update/delete/insert actions via POST •Avoid update/delete/insert actions via GET, as much as you can
  • 27. WRITING SAFE AND SECURE CODE IN SHAREPOINT
  • 28. Rule #11: Mind workflow numbers •Keep in mind List View Threshold and Trottlingfor history and tasks lists •Be careful with item level permissions, as already stated •Dependanttasks and task-level permissions are not supported out of the box by the Workflow Manager tools •You have to manually create custom actions for that
  • 29. Rule #12: Caching, caching, caching! •Avoid useless network roundtrips •Keep in cache frequently accessed and rarely changing data •SharePoint Objects •Lookup data •Images, blob files, etc. •Out of the box there are •Object Cache •Output Cache •BLOB Cache •Use them to improve performances and response time •In particular in Public Facing Web Sites, but not only
  • 30. Rule #13: Try to always use CQWP/CSWP •In Public Facing Web Sites always try to use •Content by Query Web Part •Content by Search Web Part •These web parts do a good caching of results •Thus, improving the overall perceived time •You only have to focus on XSLT or HTML Templates •Fallback to DataFormWebPartor XsltWebPart •Lastly, if you can’t avoid it, fallback to custom a WebPart
  • 31. Rule #14: Don’t use Session or in-memory data •Avoid storing sessions or in-memory data on a single server •It wouldn’t scale across multiple servers •Only cached data that can stay in-memory of a single server •If you don’t adhere to this rule •The solutions will not scale horizontally •You will have to configure NLB affinity (very bad idea!) •The overall availability of the solutions will be reduced
  • 32. Rule #15: Avoid single points of failure •Create code ready to be executed on multiple servers •Avoid relying on web.configor app.configdirectly •Avoid looking for specific files on the file system •Use only shared resources accessed through a provider •To abstract from the physical location of data/content •Mind data concurrency across multiple servers •Provide concurrency checks and optimistic concurrency •If you don’t adhere to this rule •Your solution will not scale •You will have to activate affinity, which will impact availability, as well
  • 34. thank you. SHAREPOINT AND PROJECT CONFERENCE ADRIATICS ZAGREB, 10/14/2014 -10/15/2014