- Get hold of the IIS logs from all production servers and copy them into a single folder e.g.
- Server1
- W3SVC1
- ex12345.log
- Server2
- W3SVC1
- ex12345.log
- Download and install LogParser, if you don't have it.
- Run the following PowerShell from within the log folder root:
& 'C:\Program Files (x86)\Log Parser 2.2\LogParser.exe' -i:iisw3c -recurse:-1 "select to_localtime(to_timestamp(date, quantize(time, 3600))) as LocalTimeBlock, count(*) as Count into Logs.csv from *.log where date is not null and `"cs(User-Agent)`" not like '%pingdom%' group by LocalTimeBlock"
This query converts all dates and times into one hour blocks int local time and excludes requests from Pingdom, which we use for uptime monitoring. - Load the generated Log.csv in Excel and create a scatter plot from the two columns.
Monday, July 29, 2013
Finding the quietest time to do disruptive maintenance with IIS
Saturday, July 20, 2013
Latency timings for various Azure datacentres.
The tool can be found at http://azureping.info.
Wednesday, July 17, 2013
Disable the "Attach Security Warning" dialog box
For those who want to silence this dialog forever, run the following PowerShell one-liner:
taskkill /IM devenv.exe; while(get-process -ea 0 devenv) { Write-Host "Waiting for Visual Studio to shut down..."; Start-Sleep -sec 1 }; ls HKCU:\Software\Microsoft\VisualStudio | % { $_.PSPath + "\Debugger" } | % { sp -ea 0 $_ DisableAttachSecurityWarning -Type DWORD -Value 1 }
Tuesday, July 16, 2013
Format a drive from PowerShell
$disk = Get-Disk | ? PartitionStyle -eq Raw $disk | Initialize-Disk $part = New-Partition -DiskNumber $disk.Number -UseMaximumSize Initialize-Volume -Partition $part -FileSystem ReFS Add-PartitionAccessPath -DiskNumber $disk.Number -PartitionNumber $part.PartitionNumber -AccessPath D:\
Thursday, July 4, 2013
Overhead of using async and await in C# 4.5
Although asynchronous code is touted as allowing for more scalable architectures through less threads (a la nodejs), there must be a latency overhead to this technology. While the total throughput of the system may be higher, an individual request must be slowed down due to increased context switching.
I was interested in seeing how much of a performance impact there is to using the new Async pattern in .NET (and simplified using the fantastic async / await keywords in C#).
I wrote an application that compares the FileStream.Read and FileStream.ReadAsync calls in a tight loop, reading one byte into a byte array 1 million times. Tweaking the file size and other parameters resulted in very different results, although the synchronous call was always at least five times faster than the asynchronous call.
Results
File length: 1000000 bytes. Running 100 loops of Preload... Done in 0 ms. Running 1000000 loops of Asynchronous... Done in 2452 ms. Running 1000000 loops of Synchronous... Done in 17 ms.
Conclusion:
In this single test scenario, using this particular method of file access, the overhead of using asynchronous calls for very fast operations is significant in that an operation that takes around 20 ms synchronously runs at 2500 ms asynchronously (125 times slower). In practice, this is an overhead of 0.00000248 seconds (2.5 μs) per asynchronous call. Whether this overhead is acceptable, and whether the reduction in system resources that asynchronous calls are supposed to yield is worth this slowdown is application dependent.