I expect your ideas so much for my situation.
I built a RestfulAPI using vertx 4.5.7, vertx-pg-client same version.
When starting I configured pool like this:
final PgConnectOptions connectOptions = new PgConnectOptions();
connectOptions
.setHost("host_example")
.setPort(8080)
.setDatabase("db_example")
.setUser("user_example")
.setPassword("password_example");
final PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
When I call 1,2 or 3 APIs concurrently to the service, response time still good, perhaps 40-50ms per request.
But the problem happend when I call 8 or 10 APIs concurrently, response time start to become slower, >100ms per request.
I think may be due to DB connection but when call just 1 response time is very good.
APIs I created is quite easy and I dont think it’s due to DB connection pool.
dbClient.getConnection().compose(
conn -> testRepo.getListCities()
.onSuccess(data -> response.end(Json.encodePrettily(data)))
.onFailure(throwable -> response.end(Json.encodePrettily("example exception")))
);
I applied many solutions, for example:
vertx.createHttpClient(new HttpClientOptions()..setMaxPoolSize(20))
But it’s not working!
Is there any help? Many thanks you all!