Here is a PowerScript function to automate the process of getting/logging the current number of connections to a particular Web Server. It will tell you the number of connections for each site on the server, so you can see the number of SharePoint connections, SharePoint Central Admin connections, etc. Thanks to MOW and Lee Holmes for their examples of using the PerformanceCounter class in PowerShell.
This will give me output like so:
You could set the CounterName to any of the other Web Service counters that are available, to do things like measure incoming and/or outgoing bytes per second, the number of incoming HTTP requests per second, etc. To see a list of all available counters, use the GetCounters() method of the PerformanceCounterCategory ($cat in the example above, ie $cat.GetCounters(“SharePoint – 80”)).
Also, to get more information, you can use $perfmon.NextSample() instead of .NextValue(). NextSample() will return the enture CounterSample object, including RawValue and BaseValue (used to determine the value returned by NextValue()), TimeStamp, etc.