Created
November 23, 2019 07:00
-
-
Save xtellurian/49645c29a91cd27945b15553054d4bb0 to your computer and use it in GitHub Desktop.
Latency Tester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp3.0</TargetFramework> | |
</PropertyGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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