Skip to content

Instantly share code, notes, and snippets.

View vietj's full-sized avatar
🤖
Coding the Future

Julien Viet vietj

🤖
Coding the Future
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<title>Perflab results</title>
<style>
body {
font-family: monospace;
font-size: 12pt;
@Test
public void testPipeliningOrder() throws Exception {
client.close();
client = vertx.createHttpClient(createBaseClientOptions()
.setKeepAlive(true)
.setMaxPoolSize(1)
);
package org.creekservice.kafka.test.perf.performance;
public class Main {
public static void main(String[] args) throws Exception {
org.openjdk.jmh.Main.main(new String[]{
JsonValidateBenchmark.class.getName() + ".measureDraft_04_Vertx",
"-prof", "async:" +
"libPath=/Users/julien/java/async-profiler-2.9-macos/build/libasyncProfiler.dylib;" +

Vert.x Virtual Threads

Use virtual threads to write Vert.x code that looks like it is synchronous.

You still write the traditional Vert.x code processing events, but you have the opportunity to write synchronous code for complex workflows and use thread locals in such workflows.

Introduction

The non-blocking nature of Vert.x leads to asynchronous APIs. Asynchronous APIs can take various forms including callback style, promises or Rx-style. Vert.x uses futures in most places (although, it also supports Rx).

@vietj
vietj / vt.adoc
Last active October 24, 2023 07:35

Vert.x Virtual Threads

Use virtual threads to write Vert.x code that looks like it is synchronous.

You still write the traditional Vert.x code processing events, but you have the opportunity to write synchronous code for complex workflows and use thread locals in such workflows.

Introduction

One of the key advantages of Vert.x over many legacy application platforms is that it is almost entirely non-blocking (of kernel threads) - this allows it to handle a lot of concurrency (e.g. handle many connections, or messages) using a very small number of kernel threads, which allows it to scale very well.

@vietj
vietj / El Dogo.csv
Last active January 31, 2023 16:54
--- Tour 1 Tour 2 Tour 3 Tour 4 Tour 5
X=0 55.06% 30.22% 16.81% 9.21% 5.05%
X=1 0.00% 0.00% 0.00% 0.00% 0.03%
X=2 0.00% 0.00% 0.00% 0.18% 0.18%
X=3 0.00% 0.00% 0.98% 0.57% 0.39%
X=4 0.00% 5.88% 3.32% 2.18% 1.71%
X=5 34.30% 19.44% 10.67% 7.41% 4.36%
X=6 3.25% 1.83% 7.32% 5.48% 4.29%
X=7 0.31% 12.69% 9.63% 6.35% 5.56%
X=8 2.12% 14.58% 8.44% 8.81% 6.77%
@vietj
vietj / db.png
Last active February 1, 2024 03:09
Vert.x virtual thread benchmark
db.png
@vietj
vietj / index.html
Last active November 7, 2022 14:26
TFB 202-11-01 Json
<!DOCTYPE html>
<html lang="en">
<head>
<title>Perflab results</title>
<style>
body {
font-family: monospace;
font-size: 12pt;
@vietj
vietj / index.html
Last active November 7, 2022 14:26
TFB 2022-11-01 Fortunes
<!DOCTYPE html>
<html lang="en">
<head>
<title>Perflab results</title>
<style>
body {
font-family: monospace;
font-size: 12pt;
@vietj
vietj / index.html
Last active November 7, 2022 14:27
TFB 2022-11-01 Db
<!DOCTYPE html>
<html lang="en">
<head>
<title>Perflab results</title>
<style>
body {
font-family: monospace;
font-size: 12pt;