Skip to content

Instantly share code, notes, and snippets.

@xtellurian
Created November 23, 2019 07:00
Show Gist options
  • Save xtellurian/49645c29a91cd27945b15553054d4bb0 to your computer and use it in GitHub Desktop.
Save xtellurian/49645c29a91cd27945b15553054d4bb0 to your computer and use it in GitHub Desktop.
Latency Tester
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class Program
{
private const string frontDoor = "https://beta.amphoradata.com/healthz";
private const string appSvc = "https://appsvc62a56562.azurewebsites.net/healthz";
public async static Task Main()
{
Console.WriteLine("Starting test");
var client = new HttpClient();
await RunTest(client, frontDoor);
await RunTest(client, appSvc);
Console.WriteLine("Finished");
}
private static async Task RunTest(HttpClient httpClient, string url)
{
var xstartTime = DateTime.Now;
var xres = await httpClient.GetAsync(url);
xres.EnsureSuccessStatusCode();
var xendTime = DateTime.Now;
Console.WriteLine(url + " took " + (xendTime - xstartTime).TotalSeconds + " sec");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment