vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

ThreadingModel.VirtualThread significant performance drop.

Open sanIncredible opened this issue 1 year ago • 6 comments

Questions

Version

4.5.8

Context

while running existing application with ThreadingModel.VirtualThread , application performance dropped significantly.

Do you have a reproducer?

Yes

Steps to reproduce

  1. deploy a verticle containing HTTP server , responding every request wuth 200-OK
  2. first execute with ThreadinModel.EventLoop
  3. execute with ThreadingModel.VirtualThread
  4. run http load test.

EventLoop model results : 31000 request per second Virtual Thread model results : 811 request per second.

CPU utilization is very less in VT model ,

image

Extra

  • Anything that can be relevant such as OS version, JVM version

openJdk 21

sanIncredible avatar Jun 30 '24 14:06 sanIncredible

can you share your entire benchmark @sanIncredible without it, those numbers don't mean a lot

vietj avatar Jul 01 '24 05:07 vietj

not sure if these would help , cant upload whole JFR due to organization policy.

image image image

sanIncredible avatar Jul 01 '24 14:07 sanIncredible

that does not help a lot, can you provide a small project that reproduces it ? like a minimalistic HTTP server with vertx and a client

vietj avatar Jul 01 '24 14:07 vietj

`

public class BootStrapp{

public static Vertx getVertx(){

}

private static Vertx vertx;

public static void main(String [] args){ vertx = Vertx.vertx(); DepolymentOptions options = new DeploymentOptions(). setThreadingModel(ThreadingModel.VIRTUAL_THREAD; //setThreadingModel(ThreadingModel.EVENT_LOOP;

vertx.deployVerticle(MainVerticle.class.getName(),options,res->{ if(res.failed()){ } else{

}

});

} }

public class MainVerticle extends AbstractVerticle{ @Override public void start(Promise<Void> startPromise) throws Exception {

Vertx vertx = BootStrapp.getVertx(); Router router = Router.router(vertx);

router.route().handler(BodyHandler.create());

router.get("/getDemo/").handler(this::getHandler);

vertx.createHttpServer().requestHandler(event->router.handle(event)).listen(8890,"127.0.0.1",result->{ if(result.succeeded()){ startPromise.tryComplete(); } else{ startPromise.fail(result.cause()); } });

}

private void getHandler(RoutingContext context) context.response().setStatusCode(201).end(); }

`

Client used :: https://nghttp2,org/documentation/h2load-howto.html

sanIncredible avatar Jul 02 '24 03:07 sanIncredible

image

This call sequence is not there in Eventloop model. is this causing performance issue ?

sanIncredible avatar Jul 04 '24 16:07 sanIncredible

can you try with Vert.x 5 ?

vietj avatar Mar 10 '25 14:03 vietj