Working with a customer, we saw that they had 20 or so web application pools, each with 1 web application each. The software boundary for SharePoint 2010 is to have no more than 10 web application pools. Because each application pool can have multiple web applications assigned to it, and easy fix is to just move the web applications to new application pools.
I have seen several blogs and even forum posts that indicate you can just change the application pool in IIS. This is not sufficient, because SharePoint maintains a reference to the application pool and the managed account assigned to the application pool. If you change it in IIS without telling SharePoint, you can cause orphaned configuration data which may prevent you from being able to apply updates or upgrades.
There’s no UI to change the application pool in Central Administration, the only way to change this is through the object model. Luckily this is pretty simple to do using PowerShell.
$webService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$pool = $webService.ApplicationPools["SharePoint - AuthTest80"]
$app = Get-SPWebApplication http://teamsapp
$app.ApplicationPool = $pool
The trick here is to use the ProvisionGlobally method. If you leave this out, it changes the setting in SharePoint’s configuration data, but does not make a change in IIS. ProvisionGlobally will make the change in IIS as well, and will do this for every server in your farm… another huge benefit for doing this through the object model instead of manually updating the setting in IIS for every server in your farm!