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 characters
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class Main { | |
static { | |
System.out.println("here we go..."); | |
try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) { | |
executor.submit(() -> {}).get(); | |
} catch (Exception e) { |
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 characters
package io.vertx.example.grpc.helloworld; | |
import com.google.protobuf.Message; | |
import com.google.protobuf.Struct; | |
import com.google.protobuf.util.JsonFormat; | |
import io.vertx.core.AbstractVerticle; | |
import io.vertx.core.Future; | |
import io.vertx.core.Launcher; | |
import io.vertx.core.buffer.Buffer; | |
import io.vertx.core.net.SocketAddress; |
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 characters
/* | |
* Copyright 2021 Andrei Pangin | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 <application> <N>" | |
exit 1 | |
fi | |
application="$1" | |
N="$2" |
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 characters
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.Executor; | |
import java.util.concurrent.Executors; | |
public class VThreadCreation { | |
private static final int TASKS = 1024; | |
public static void main(String[] args) throws InterruptedException { | |
long rounds = Long.MAX_VALUE; | |
if (args.length == 1) { |
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 characters
package red.hat.puzzles.concurrent; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.Executor; | |
import java.util.concurrent.Executors; | |
@State(Scope.Benchmark) |
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 characters
#!/bin/bash | |
wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 5 -c 8 --timeout 8 -t 8 http://localhost:8080/db | |
wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 64 "http://localhost:8080/db" | |
wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 16 --timeout 8 -t 16 "http://localhost:8080/db" | |
wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 32 --timeout 8 -t 32 "http://localhost:8080/db" | |
wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,applicat |
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 characters
package red.hat.puzzles.concurrent; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.lang.invoke.MethodHandles; | |
import java.lang.invoke.VarHandle; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicLongFieldUpdater; |
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 characters
Hottest code regions (>10.00% "cycles" events): | |
....[Hottest Region 1].............................................................................. | |
c2, level 4, java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite::setVolatile, version 767 (0 bytes) | |
0x00007fdf24a22f4e: add %rcx,%rsi | |
0x00007fdf24a22f51: mov (%rsi,%r11,1),%r11 | |
0x00007fdf24a22f55: cmp %r11,%rax | |
╭ 0x00007fdf24a22f58: jne 0x00007fdf24a22f7b ;*invokevirtual putLongVolatile {reexecute=0 rethrow=0 return_oop=0} | |
│ ; - java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite::setVolatile@27 (line 154) |
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 characters
private static final int NOT_ASCII = 128; | |
private static final boolean[] RESERVED = new boolean[256]; | |
static { | |
final int[] reservedChars = new int[] {'+', '#', '/', ';', '?', '&', ' ', '!', '=', '$', '|', '*', ':', '~', '-'}; | |
for (int c : reservedChars) { | |
RESERVED[c] = true; | |
} | |
assert !RESERVED[NOT_ASCII]; | |
} |