SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL
SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL

SPPatchify

I Wanna Patch FAST

Want to patch your SharePoint farms faster?  Try running https://github.com/spjeff/sppatchify

 

The latest version (0.42) includes new PowerShell code for parallel execution of “Upgrade-SPContentDatabase.”  This was implemented with “Get-Job” and PowerShell job management to remote sessions. 

The more user content databases you have, the greater the time savings.  Below are summary statistics from patching a 9 server SharePoint 2013 farm with 200 SQL content databases in just 4 hours.  Each of the 9 servers will spawn 4 PowerShell remoting runspaces for “Upgrade-SPContentDatabase.”  With 36 concurrent worker threads, the queue of 200 content databases now becomes only 6 deep.  

Instead of waiting 200 units of time to process content databases serially, we now only wait 6 units of time for the upgrade database phase.

Larger farms with more user content (and databases) will see significant overall time savings considering how a majority of the traditional patching timeline is processing all content databases.    The binary EXE phase runs with all content databases  removed (Dismount-SPContentDatabase ) so PSCONFIG can complete sooner.    After that is done, content is introduced again (Mount-SPContentDatabase) and upgraded (Upgrade-SPContentDatabase).

 

Amazing speed!!!    Cheers 

 

 

Charts

 

image

 

image

 

image

 

Image result for i wanna go fast

 

 

SPPatchify

Open source hosted on GitHub

 

image

Business Case for Minimal Downtime Patching (MDP)

After watching the Zero Downtime Patching (ZDP) TechNet video, I wanted to share my thoughts about when that is helpful and when a simpler approach is needed.   Ultimately we are given options and asked to balance cost with questions such as:

  • What is the cost of outage/downtime?
  • What is our SLA?
  • What hours do users normally work?
  • What is the cost of High Availability redundant farm topology?
  • What is the support effort to maintain HA farms?
  • What is the VM, licensing, and storage cost?
  • Bottom line – Does the cost of outage exceed the cost of HA?   Or vice versa?

 

What is ZDP?

  • [TechNet] “Zero Down-Time patching doesn’t demand any server downtime while patching a SharePoint Server 2016 farm, but does require that your farm be set up in a Highly Available (HA) configuration (so that SharePoint roles are hosted on more than one server). That way, patching can be done in batches where certain of the redundant servers are taken out of load balancing, patched, replaced, and tested for soundness before the other servers follow through the same process.  During Zero down-time patching, users can add and edit files and use search just as at any other time.”

 

What is MDP?

  • I would define Minimal Downtime Patching as “Planning an acceptable window of brief downtime to apply system updates as quickly as possible.”     This implies an SLA less than 99.99% and 365/24 hour availability.   Choosing a time window for a brief outage is already done today by most support teams.   A few hours outage might come at zero cost (if zero active users) and is often an attractive choice compared to the complexity of Highly Available (HA) farm design, implementation, and support.  ZDP is a high cost endeavor, appropriate for scenarios with high cost of downtime.   Absent that, we should consider lower cost options where brief downtime is acceptable with little impact.    Compare two costs and choice what is best for your business.

 

Cost/Benefit

  Zero Down Time
(ZDP)
Minimal Down Time
(MDP)
Cost
  • HA topology required
  • More complex
  • More server cost
  • VM, storage, license, and support
  • Detailed procedure
  • Not available to users
  • Full outage during Config Wiz

 

Benefit
  • 100% available to users
  • Read & write features
  • Supports any topology
  • Brief outage
  • Works on Dev, Test, small farms
  • Simple
  • No additional servers
  • Single PowerShell console

 

Overall, use the right tool for the job.  There are good scenarios for both options.  Even with ZDP used on large Production farms, we need other suitable options for lower environments like Dev and Test.

Cheers! 

shades_smile

 

References

 

MDP PowerShell Script

 

SPPatchify – CU patch entire farm from one script

Patching can be tedious and time consuming.   Why not automate that?  Who wants to be awake all night clicking “Next” and watching SP config wizard?  So  I coded a single PowerShell script to manage the full end-to-end patching process.

 

The script will …

  • Enable PowerShell client remoting.  Connects to farm peer machines.
  • Autodetect current user password from IIS pools
  • Download Microsoft Cumulative Update (CU) media (EXE +CAB) and copy to all servers.   Optionally, you can download to the \media\ sub folder manually.
  • Stop Distributed Cache (DC)
  • Stop SharePoint services
  • Run EXE binary in paralle
  • Wait for EXE to complete and reboot
  • Dismount-SPContentDatabase
  • Start SharePoint services
  • Run SharePoint Config Wizard serially
  • Mount-SPContentDatabase
  • Remove Microsoft Cumulative Update (CU) media from peer servers
  • Ensure IIS started
  • Launch Central Admin with IE
  • Reboot current PC

 

Duration from start to end is incredibly fast.    I tested a 4 server SharePoint 2013 farm and ran the entire process in just 45 minutes.   Stopping services and dismounting content databases speeds up patching significantly.    Automating serial (one-at-time) Configuration Wizard ensures minimal “think time” between steps.   Removing manual human process gives higher consistency while mitigating risk of error.

The script uses Get-SPServer to auto detect farm members.   That enables CU media copy sideways to peers and the stop/start of SharePoint services.   Get-SPContentDatabase is exported to a local CSV file to “snapshot” before patching and later Mount-SPContentDatabase step to present databases again.   The big goal isn’t zero downtime, but rather minimal downtime.  

The entire farm patching process can be managed from one PowerShell window.  Enjoy! 

shades_smile

 

Please leave a comment if you found this helpful.

 

Get Started

  1. https://github.com/spjeff/sppatchify
  2. Extract to “C:\SPPatchify” on any server in the farm
  3. RDP with farm account and run “C:\SPPatchify\SPPatchify.ps1”

 

Flow Diagram

6

 

Screenshots

image
5
image
image
image
image

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲