Skip to content

Instantly share code, notes, and snippets.

@nordineb
Last active November 11, 2016 09:05
Show Gist options
  • Save nordineb/cbff6341bb4f44c3390e15f901934f45 to your computer and use it in GitHub Desktop.
Save nordineb/cbff6341bb4f44c3390e15f901934f45 to your computer and use it in GitHub Desktop.
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
[System.Net.ServicePointManager]::Expect100Continue = {$false}
[System.Net.ServicePointManager]::CheckCertificateRevocationList = $true;
[System.Net.ServicePointManager]::DefaultConnectionLimit = 1000;
[System.Net.ServicePointManager]::MaxServicePoints = 1000;
[System.Net.ServicePointManager]::ReusePort = $true;
[System.Net.ServicePointManager]::UseNagleAlgorithm = $false;
[System.Net.ServicePointManager]::EnableDnsRoundRobin = $false;
$url = "https://data-nsr.udir.no"
$enheter = Invoke-RestMethod -Uri "$url/enheter" -DisableKeepAlive
$n = 1;
$sw = [Diagnostics.Stopwatch]::StartNew()
foreach($e in $enheter)
{
If ($n -ge 1000) { break; }
$id = $e.NSRId
$enhet = Invoke-WebRequest -Uri "$url/enhet/$id"
$n++;
}
$sw.stop();
"Thoughput: $($n/$sw.Elapsed.TotalSeconds) enheter/sek."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment