Created
June 25, 2014 13:18
-
-
Save shawnweisfeld/278ac6601807cc67ca18 to your computer and use it in GitHub Desktop.
ping a Azure CDN endpoint to see how fast you can get the file and record the results.
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
static void Main(string[] args) | |
{ | |
var url = "http://az590556.vo.msecnd.net/app/ec951196-2be1-4539-9e8f-3fc9f59590a9/client.js"; | |
while (true) | |
{ | |
using (HttpClient client = new HttpClient()) | |
{ | |
var sw = new Stopwatch(); | |
sw.Start(); | |
var result = client.GetAsync(url).Result; | |
sw.Stop(); | |
IEnumerable<string> cache; | |
string cacheString = "NONE"; | |
if (result.Headers.TryGetValues("X-Cache", out cache)) | |
{ | |
cacheString = string.Join("-", cache); | |
} | |
var message = string.Format("{0:G},{1},{2},{3}", System.DateTime.Now, result.StatusCode, sw.ElapsedMilliseconds, cacheString); | |
Console.WriteLine(message); | |
File.AppendAllText("result.txt", message + Environment.NewLine); | |
} | |
System.Threading.Thread.Sleep(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment