Monday, 24 October 2011

netapp perfstat

I needed to run some perfstats today to capture some benchmarking, unfortunatley the netapp provided example didnt work for me which is listed as:

perfstat -f filer1 -t 30 -i 46 > perfstat-"Date_%date:~4,2%%date:~7,2%%date:~10,4%-Time_%time:~0,2%h%time:~3,2%m%time:~6,2%s"

Having had a quick look at this, there are a number of reasons, I am on windows 2008 r2 and its trying to RSH - dont bother in 2008.. you need to use plink as stated in the documentation. so i changed the cmd line to use plink as follows, substitute username and password...

perfstat -S pw:netapp -l root -f filer1 -t 30 -i 46 > perfstat-"Date_%date:~4,2%%date:~7,2%%date:~10,4%-Time_%time:~0,2%h%time:~3,2%m%time:~6,2%s"

This still didnt work as the SSH host key hadnt been saved on the system I was using, quick work around, fire up putty, Login whilst saving the key.

Running this: perfstat -S pw:netapp -l root -f filer1 -t 30 -i 46 now works.

The next problem I have is the date format my system is using or something I couldnt be bothered to investigate.. so if you do

echo Date_%date:~4,2%%date:~7,2%%date:~10,4%-Time_%time:~0,2%h%time:~3,2%m%time:~6,2%s

You get a garbled date string back with a slash in it this is because the example expects echo %date% to return the day of the week ie, Mon 24/10/2011

Where as mine displays a short date ie 24/10/2011, This is a simple fix, but for reference in DOS part of a string can be retuned (MID) by the following VariableName Start,Legth Which in this case %date:~4,2% should return 24 as %date% SHOULD = Mon 24/10/2011 but it doesn't.

Anyway here's the modified version for todays use - however I shoved it into a batch file to run both filers

@echo off
start perfstat -S pw:netapp -l root -f filer1 -t 30 -i 46 > c:\perfstat\Filer1_perfstat-Date_%date:~0,2%_%date:~3,2%_%date:~6,4%-Time_%time:~0,2%h%time:~3,2%m%time:~6,2%s
start perfstat -S pw:netapp -l root -f filer2 -t 30 -i 46 > c:\perfstat\Filer2_perfstat-Date_%date:~0,2%_%date:~3,2%_%date:~6,4%-Time_%time:~0,2%h%time:~3,2%m%time:~6,2%s

Thursday, 20 October 2011

slow sql connections

I had a wierd problem today whilst we were doing some testing, we have a web application which was producing random results and no consistent performance, we though initally it was SQL being slow, but looking at profiler it was returning the queries in around 11ms once it actually got the request.

After bodging our way around some firewalls to rule them out I eventually knocked up a rough and ready vbs script that echoed the current time then attempted to do an ADODB connection to the database and then echo the time out again..

set myconn = createObject("ADODB.Connection")

wscript.echo now() ="DRIVER={SQL Server};SERVER=\TEST;OPTION=35"
wscript.echo now()
Each time I executed this it took 9 seconds just to connect.

After much playing running the script locally on the sql box it resulted in returning immediatley, I installed wireshark on the DB box and had a look at what was happing, we were seing a few packets for LLMNR, I disabled this in group policy (Computer Configuration\Administrative Templates\Network\DNS Client\Turn off Multicast Name Resolution) this made no difference -apart from stopping this traffic, I then disabled LMHOSTS lookup and disabled NetBIOS over TCP/IP this didnt make a difference either.

I then added the hostname of the sql server into the clients hosts file and this resolved the issue immediatley.. from looking at an early MDAC bug relating to sql 2000 it seems that this was previously a bug - which has been fixed but it attempts to do a reverse lookup and then times out after 5 seconds - despite me specifying the ip\instance name as there is no DNS in use in this enviroment!

Anyway its fixed it for now, I may try and MDAC update later but for now Ill move on and find the next problem.