eclipse-vertx / vert.x

Vert.x is a tool-kit for building reactive applications on the JVM
http://vertx.io
Other
14.32k stars 2.08k forks source link

ThreadingModel.VirtualThread significant performance drop. #5245

Open sanIncredible opened 4 months ago

sanIncredible commented 4 months ago

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

vietj commented 4 months ago

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

sanIncredible commented 4 months ago

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

image image image

vietj commented 4 months ago

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

sanIncredible commented 4 months ago

`

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 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 commented 4 months ago

image

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