Wednesday 20 November 2013

Limiting the number of Distribute Cache Instances


Problem:  Revieiwing the results of the SharePoint Health Anayser, I get an error relating to the Distributed cache "This Distributed Cache host may cause cache reliability problems".  I assumed unprovioning the service instance for distributed cache was correct.

Initial Hypothesis:  I use AutoSPInstaller to install my DTAP environments, once the environment got over 4 servers I saw this error.  I run a cleanup task that "Unprovisions" the "Distributed Cache" instances on all servers except my web front-end servers.  I still get the warning.  I read Steve Mann's post "It turns out that you actually need to remove the service from the servers that shouldn't run it - not stop it - actually remove it. This can be peformed using the SharePoint PowerShell cmdlet Remove-SPDistributedCacheServiceInstance" 
 
Resolution: You want to have 4 or less instances of the Distributed Cache Service.  I put these on my SharEPoint servers performing the Web Front End Role.
Run this PS to see where your Distributed Cache services are installed (running and unprovisioned):
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"


Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName }
 

Monday 18 November 2013

Reducing Ldf sizes for SP Config DB using AOAG

WARNING: DO not follow this post - I have just destroyed a Test farm doing a quick fix to reduce the logs!!!!

Also see this post regarding ldf shrinking

Problem: ldf files grow continuously when the database is in "Full" recovery mode and the database transaction log is not backed up.  This scenario is common in test and developer environment where full backup cycles are not performed regularly. 

This post shows a method of clearing down the transaction logs.  This is merely to created space not for backup purposes.

Scenario:  My scenario is a test environment SQL contains 2 VM's using SQL using Alway On (AOAG) with 2 times 100GB hard drives.  The databases are not backed up and all db's are in the Full Recovery mode.  My SP Config db ldf has grown rather big and needs to be reduced.


Tip:  If you are using always on availability, you can't simply backup the logs, making a checkpoint and shrink the log.  I need to remove the db from the AOAG and then go to the ldf shrink actions, this is painful.

Fix:
1. On the Primary using SQL Management studio remove the db from the AOAG databases.
2. Backup the config db.  SQL Management Studio > Open the SQL instance where SP databases are located > Right click on the config db e.g. "AutoSP_Config"> Tasks > Backup > Set the "Backup Type" to "Transaction Log" and perform the backup.
3. Run the "CheckPoint" T-SQL cmd
4. Perform the backup again (as done in step 2).
5. Shrink the log.   SQL Management Studio > Right click on the database > Tasks > Shrink
6. After the logs have been reduced add the database back to be a AOAG database.

More Info:
http://kerseub.wordpress.com/2012/04/10/sql-server-2008-2008r2-shrink-ldf-files/
 

Saturday 9 November 2013

IaC Presentation for SharePoint Saturday UK

Overview: I am presenting at SharePoint Saturday UK (9 November 2013).  This post contains my slide deck and will answer any questions that arise from the session.

SharePoint Saturday UK 2013 Web Site

 Infrastructure as Code for SharePoint 2013 PowerPoint Presentation

Outline of the session:
Creating automated farm builds is key to having a stable SharePoint on-prem. service. This session looks at how and why automating infrastructure, SharePoint 2013 builds and assets is a good idea. The session is heavily focused on Infrastructure as Code (IaC). I look at building a large on premise SP2013 stretched farm on stable repeatable infrastructure that includes SSRS, WCA/OWA and Blob storage.

This is a technical overview for IT pro’s & architects, throwing in best practices for looking at large SharePoint 2013 deployments. Concepts such as devops and Continuous Delivery (CD) are examined. PowerShell is extensively used with several takeaways provided to jumpstart SharePoint 2013 service creation via IaC.

Monday 4 November 2013

PowerShell Tools for Visual Studio

Problem:  I like PowerGUI for my PowerShell IDE but I want to be able to work with my PS files with source control (TFS). 

Initial Hypothesis:  Ideally I want Visual studio to work like PowerGui namely, providing line count, local variables, debugging, colour coding and intelesense.

Resolution:
PowerGui has a plug-in for Visual Studio but it only works on old versions of PowerGui.  I find it not worth the errort for the value the tool adds.

PowerShell Tools for Visual Studio is a VSIX plugin for Visual Studio that appears to meet all my requiremnts.

More Info:
http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

Friday 1 November 2013

Where is MS taking SharePoint Development

The communities reaction to the app model for SharePoint 2013 has been interesting over the past year.  Please post your thoughts!

I got this email recently:
"I've been doing some 2013 development using the traditional farm solution approach.  using c# code behind. I think that this is the way most SP2013 projects will be developed. Why? because 99.9% of SharePoint developers know how to do it this way and that's everyone's skill set. I think Apps will be used when the clients requirements need functionality that needs to be isolated. You can't communicate cleanly between apps. I also think that using an Agile approach to development that is app based solution is dangerous in that the client nearly always changes the requirements. That could mean a complete rewrite of the App or change approach. Not good for consultancies who never give you enough time anyway."

My reply:
Using the SharePoint App model for development has no integration or ALM capabilities so it is fine for building little bits of functionality or for companies providing generic apps for say a generic intratent.  The 3 models have difference strengths, the best generally is the provider hosted and I feel this is not SharePoint but external development that I merely surface in SP.

Building complex system in SharePoint has been hugely successful and has great folks that can bend SharePoint, the app model has it's place but I don't see it replacing proper business solutions delivered thru SP.

Another person was complaining to me recently along the lines of "even if you know JS and the provider models it takes 5 times as long to develop functionality that using the solution approach."

Bill Ayers Provided a nice session on The Good the bad and the Ugly of the App Model for SharePoint.  He has a video that is hillarious.

 

Thursday 31 October 2013

Monitoring SharePoint 2013

Overview: SharePoint farms have several dependencies so to effectively monitor your farm there are a lot of components to review.  Basically there are 2 forms of monitoring: Preventative & Reactive.  Also see my post on performance monitoring SP 2013.

Preventative Monitoring: is reviewing your SharEPoint estate to try identify issues before they occur.  A simple example would be identifying that your database is running out of storage space allowing you to remediate before the system fails.

Reactive Monitoring: is ensuring you are notified as early as possible so you can identify the root cause and fix with minimal downtime.  This can be a simple as waiting for the help desk to escalate that the farm is down.  In maturing this a simple set of web requests that alert the administrators as soon as a service is down is an improvement.

Monitoring needs to be a combination of preventative and reactive monitoring done via automation and manual verification.  As the automation piece improves, there is less reliance on the manual monitoring.

Tooling:
There are a wealth of tools such as SolarWinds and it's competitors "Enterprise IT management from such vendors as CA Technologies (UniCentre), BMC, IBM (Tivili), and Hewlett-Packard (OpenView)."  Wikipedia

SolarWinds Monitoring Screen

Idera have monitoring tools specifically for SharePoint.  SolarWinds is a good option for monitoring SP farms and its dependencies: Windows OS, Machine resources, SQL, SP, WCA/Office Web Apps.  Couple this with web monitoring and you get a comprehensive reactive and preventative monitoring solution.  This will tell you before collapse if the server, OS, SQL or SP is slowing down or running out of resources.  If any or a complete service stop occurs the operations team are notified and it is highlighted where the error is as opposed to "it's not working".

AvePoints, DocAve 6 has a solid monitoring tool for SharePoint and the servers so if you already have DocAve this would be my choice.  The UI gets jumbled on big farms but overall the tool is easy to use and does a solid job.

Metalogixs Diagnostics Manager looks like a nice tool.  Very similar to the DocAve Monitor but you don't need to deploy as any pieces onto the farm.  The UI can be a bit busy but definitely a product to look at.
Metalogix's Diagnostic Manager sample screen shots

Other tools include ExtraHops traffic Monitor, by check how long response takes it determines with minimal interference how well the components/nodes in the infrastructure are performing.  DocAve 6.3 has a good monitoring solution specific to SharePoint, it will monitor down to the OS and report on CPU and Memory.

AlertFox is a monitoring service (SaaS).  It can perform http get requests at regular intervals (e.g. every 5 minutes).  This ensures your webservers stay warm, measures the response time from various location around the world and can check the speed of multistep actions such as loging into your web site and performing a search.  There are a lot of these but AlertFox is good.  It has dashboard, email and sms notification included. 

SharePoint Best Practices Analyser - CA > Monitor > Health Analyser provides a good place to see common problems.

EventViewer & ULS are also good places to do reactive and even preventative monitoring however these logs will need to be trawled manually.

Key items to monitor for me are:
1.> OS/VM: CPU, OS Memory, OS disk capacity/utilsation.
2.> Windows Services: Each role needs a set of services, so your monitoring tool can verify they are working.  An example for SharePoint servers services are shown in appendix A.  If you have agents such as DocAve from AvePoint, verify these are running.  Office Web Apps 2013's service is WACSM.
3.> SQL Server: Verify the services are running, monitor SQL performance ...
4.> SharePoint: Verify web requests are returning results and measure TTL, this may indicate a bottleneck is starting to occur.  If you are using multiple front end servers, check each server is working.

Appendix A. SharePoint 2013 Services to Monitor

WFE & APP Roles
Service
Name
Status
Startup Type
Log On As
SharePoint Administration
SPAdminV4
Started
Automatic
Local System
SharePoint Search Host Controller
SharePointSearchHostController
 
Disabled
Network Service
SharePoint Server Search 15
OSearch15
 
Disabled
Local System
SharePoint Timer Service
SPTimeV4
Started
Automatic
Demo\Sp_farm*
SharePoint Tracing Service
SPTraceV4
Started
Automatic
Demo\Sp_Service*
SharePoint User Code Host
SPUserCodeV4
 
Disabled
Demo\Sp_farm*

Search Role
Service
Name
Status
Startup Type
Log On As
SharePoint Administration
SPAdminV4
Started
Automatic
Local System
SharePoint Search Host Controller
SharePointSearchHostController
Started
Automatic
Demo\SP_SearchService
SharePoint Server Search 15
OSearch15
Started
Manual
Demo\SP_SearchService
SharePoint Timer Service
SPTimeV4
Started
Automatic
Demo\Sp_farm*
SharePoint Tracing Service
SPTraceV4
Started
Automatic
Demo\Sp_Service*
SharePoint User Code Host
SPUserCodeV4
 
Disabled
Demo\Sp_farm*

Wednesday 30 October 2013

Issues Generating wsp's using MSBuild in TFS2012

Problem: I am using a Build Definition within TFS2012 to try create a WSP package.  I am building a solution that contains multiple projects.  1 project needs to generate the wsp from it.  I have made minor customisations such as:
My Custom Build Definition
My environment is TFS 2012, VS2012 & SharEPoint 2013.

 Tip:  To clone Build Definitions you need to add the VSIX "Team Foundation Server PowerShell Tools 2012".

When I run the build I get the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (387): The "ValidatePackage" task failed unexpectedly.System.InvalidOperationException: The project service does not contain the specified project: 17939c4e-xxec-xxxx-xxxx-e18209d495db. at Microsoft.VisualStudio.SharePoint.Tasks.ValidatePackage.OnCheckParameters() at Microsoft.VisualStudio.SharePoint.Tasks.BuildTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocal


Resolution:
Install Microsoft Office Developer Tools for Visual Studio 2012 - RTM on the build controller (In my case I have TFS and I have a seperate Build Controller on my CI box so I install MS Developer Tools for VS 2012 - RTM on the CI box.

More Info:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/dc6e39e6-331d-42b2-ac16-b530ccb74d46/tfs-build-and-creating-a-sharepoint-2013-app-file



Tip: Another Point Worth Noting is the build definition can have problems if files names/locations are tool long created by the build controller.
   Tip: When setting up Visual Studio, shorten the length/location where the project/workspace is held locally as shopwn below: