Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Last active June 28, 2018 20:40
Show Gist options
  • Save vaskoz/edd14622192cc24f222d9d12d8f872a0 to your computer and use it in GitHub Desktop.
Save vaskoz/edd14622192cc24f222d9d12d8f872a0 to your computer and use it in GitHub Desktop.
JDK11 new GCs
java --show-version -verbose:gc Http.java 14:33:49
[0.011s][info][gc] Using G1
java 11-ea 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+19)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+19, mixed mode)
[0.666s][info][gc] GC(0) Pause Young (G1 Evacuation Pause) 14M->3M(128M) 8.612ms
[0.965s][info][gc] GC(1) Pause Young (G1 Evacuation Pause) 12M->5M(128M) 8.828ms
[1.148s][info][gc] GC(2) Pause Initial Mark (Metadata GC Threshold) 12M->6M(128M) 6.592ms
[1.148s][info][gc] GC(3) Concurrent Cycle
[1.166s][info][gc] GC(3) Pause Remark 7M->7M(128M) 2.660ms
[1.172s][info][gc] GC(3) Pause Cleanup 7M->7M(128M) 0.042ms
[1.173s][info][gc] GC(3) Concurrent Cycle 25.277ms
Status code: 200
11609
java --show-version -verbose:gc -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC Http.java
[0.012s][info][gc] Resizeable heap; starting at 128M, max: 2048M, step: 128M
[0.012s][info][gc] Using TLAB allocation; max: 4096K
[0.012s][info][gc] Elastic TLABs enabled; elasticity: 1.10x
[0.012s][info][gc] Elastic TLABs decay enabled; decay time: 1000ms
[0.012s][info][gc] Using Epsilon
java 11-ea 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+19)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+19, mixed mode)
[1.107s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.125s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.150s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.210s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.242s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.302s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.320s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
[1.423s][info][gc] Full GC request for "Metadata GC Threshold" is ignored
Status code: 200
11566
[1.444s][info][gc] Total allocated: 34385 KB
[1.444s][info][gc] Average allocation rate: 23813 KB/sec
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Http {
public static void main(String[] args) throws Exception {
var httpClient = HttpClient.newBuilder().build();
var response = httpClient.send(HttpRequest.newBuilder(URI.create("https://www.google.com/")).build(),
HttpResponse.BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println(response.body().length());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment