Last active
December 10, 2018 19:33
-
-
Save rpgreen/c08c255f2c546387b5b5 to your computer and use it in GitHub Desktop.
Revisions
-
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,12 +9,10 @@ public void testPerf() throws IOException { for (int i = 0; i < numRequests; i++) { long start = System.currentTimeMillis(); final CloseableHttpResponse resp = client.execute(request); resp.close(); long millis = System.currentTimeMillis() - start; if (millis > 800) { LOG.warn(String.format("Request took %dms" + ", request ID: %s, CF request ID: %s", millis, -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ @Test public void testPerf() throws IOException { final HttpGet request = new HttpGet("https://[API-ID].execute-api.[REGION].amazonaws.com/[STAGE]/[PATH]"); final int numRequests = 10000; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ @Test public void testPerf() throws IOException { final HttpGet request = new HttpGet("https://[API-ID]].execute-api.[REGION].amazonaws.com/[STAGE]/[PATH]"); final int numRequests = 10000; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,4 +36,5 @@ public void testPerf() throws IOException { LOG.info(String.format("Distribution: ")); for (int i = 0; i < histogram.length; i++) { LOG.info(i*100 + "ms - " + (i+1)*100 + "ms: " + histogram[i]); } } -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 30 additions and 30 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,39 @@ @Test public void testPerf() throws IOException { final HttpGet request = new HttpGet("https://11ro68yamg.execute-api.us-east-1.amazonaws.com/prod/lambda"); final int numRequests = 10000; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); final CloseableHttpClient client = HttpClients.createDefault(); for (int i = 0; i < numRequests; i++) { final Stopwatch sw = Stopwatch.createStarted(); final CloseableHttpResponse resp = client.execute(request); resp.close(); sw.stop(); long millis = sw.elapsed(TimeUnit.MILLISECONDS); if (millis > 800) { LOG.warn(String.format("Request took %dms" + ", request ID: %s, CF request ID: %s", millis, resp.getFirstHeader("X-Amzn-Requestid"), resp.getFirstHeader("X-Amz-Cf-Id"))); } histogram[((int) (millis / 100))]++; latencies.add((int) millis); } Collections.sort(latencies); final int p50 = latencies.get((50 * (numRequests) / 100) - 1); final int p90 = latencies.get((90 * (numRequests) / 100) - 1); final int p99 = latencies.get((99 * (numRequests) / 100) - 1); final int p100 = latencies.get((100 * (numRequests) / 100) - 1); LOG.info(String.format("Num requests: %d P50: %dms P90: %dms P99: %dms P100: %dms", numRequests, p50, p90, p99, p100)); LOG.info(String.format("Distribution: ")); for (int i = 0; i < histogram.length; i++) { LOG.info(i*100 + "ms - " + (i+1)*100 + "ms: " + histogram[i]); } -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ @Test public void testPerf() throws IOException { final HttpGet request = new HttpGet("https://11ro68yamg.execute-api.us-east-1.amazonaws.com/prod/lambda"); final int numRequests = 10000; final int[] histogram = new int[100]; -
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 6 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,5 @@ final HttpGet request = new HttpGet("https://11ro68yamg.execute-api.us-east-1.amazonaws.com/prod/lambda"); final int numRequests = 10000; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); @@ -18,7 +13,6 @@ public void testPerf() throws IOException { sw.stop(); long millis = sw.elapsed(TimeUnit.MILLISECONDS); if (millis > 800) { LOG.warn(String.format("Request took %dms" + ", request ID: %s, CF request ID: %s", millis, @@ -31,16 +25,13 @@ public void testPerf() throws IOException { Collections.sort(latencies); final int p50 = latencies.get((50 * (numRequests) / 100) - 1); final int p90 = latencies.get((90 * (numRequests) / 100) - 1); final int p99 = latencies.get((99 * (numRequests) / 100) - 1); final int p100 = latencies.get((100 * (numRequests) / 100) - 1); LOG.info(String.format("Num requests: %d P50: %dms P90: %dms P99: %dms P100: %dms", numRequests, p50, p90, p99, p100)); LOG.info(String.format("Distribution: ")); for (int i = 0; i < histogram.length; i++) { LOG.info(i*100 + "ms - " + (i+1)*100 + "ms: " + histogram[i]); } -
rpgreen revised this gist
Feb 10, 2016 . No changes.There are no files selected for viewing
-
rpgreen revised this gist
Feb 10, 2016 . 1 changed file with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,28 @@ @Test public void testPerf() throws IOException { final HttpGet request = new HttpGet("https://11ro68yamg.execute-api.us-east-1.amazonaws.com/prod/lambda"); final int numRequests = 10000; long totalLatency = 0; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); final CloseableHttpClient client = HttpClients.createDefault(); for (int i = 0; i < numRequests; i++) { final Stopwatch sw = Stopwatch.createStarted(); final CloseableHttpResponse resp = client.execute(request); resp.close(); sw.stop(); long millis = sw.elapsed(TimeUnit.MILLISECONDS); totalLatency += millis; if (millis > 800) { LOG.warn(String.format("Request took %dms" + ", request ID: %s, CF request ID: %s", millis, resp.getFirstHeader("X-Amzn-Requestid"), resp.getFirstHeader("X-Amz-Cf-Id"))); } histogram[((int) (millis / 100))]++; -
rpgreen created this gist
Jan 26, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ public void testPerf() throws IOException { // final HttpGet request = new HttpGet("http://petstore-demo-endpoint.execute-api.com/petstore/pets"); // final HttpGet request = new HttpGet("http://11ro68yamg.execute-api.us-east-1.amazonaws.com/petstore/pets"); //cf->petstore final HttpGet request = new HttpGet("https://11ro68yamg.execute-api.us-east-1.amazonaws.com/prod"); final int numRequests = 10000; long totalLatency = 0; final int[] histogram = new int[100]; final List<Integer> latencies = new ArrayList<>(); for (int i = 0; i < numRequests; i++) { final CloseableHttpClient client = HttpClients.createDefault(); final Stopwatch sw = Stopwatch.createStarted(); final CloseableHttpResponse resp = client.execute(request); sw.stop(); long millis = sw.elapsed(TimeUnit.MILLISECONDS); totalLatency += millis; if (millis > 600) { LOG.warn(String.format("Request took %dms" + ", request ID: %s", millis, resp.getFirstHeader("X-Amzn-Requestid"))); } histogram[((int) (millis / 100))]++; latencies.add((int) millis); } Collections.sort(latencies); final Integer p50 = latencies.get((50 * (numRequests) / 100) - 1); final Integer p90 = latencies.get((90 * (numRequests) / 100) - 1); final Integer p99 = latencies.get((99 * (numRequests) / 100) - 1); final Integer p100 = latencies.get((100 * (numRequests) / 100) - 1); LOG.info(String.format("Num requests: %d Avg latency: %fms", numRequests, totalLatency / (double) numRequests)); LOG.info(String.format("P50: %dms P90: %dms P99: %dms P100: %dms", p50, p90, p99, p100)); LOG.info(String.format("Distribution: ")); for (int i = 0; i < histogram.length; i++) { LOG.info(i*100 + "ms - " + (i+1)*100 + "ms: " + histogram[i]); } }