sczyh30 / vertx-blueprint-microservice

Vert.x Blueprint Project - Micro-Shop microservice application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HttpEndpoint in gateway implementation must be released

Flazhik opened this issue · comments

Hello,

According to Vert'x documentation, every used service reference (including HttpEndpointReference) must be eventually released.
http://vertx.io/docs/vertx-service-discovery/java/#_http_endpoints
However, you missed that step in your gateway implementation. In case of using HttpEndpointReference, it leads us to a bunch of established socket connections and, eventually, disability to create new connections whatsoever.

Same problem

Thanks for reporting this! I'll fix this and find a better approach to reuse the connections.

Maybe we should not retrieve service reference from service discovery during dispatching

doDispatch(context, newPath, discovery.getReference(client.get()).get(), future)

That leads us to create new Service Reference(and HttpClient inside this reference) every time. On the contrary, we must use the already created HttpClient, which can be obtained from the cache in method AbstractServiceReference.get()

Yes, we are refactoring the architecture of API Gateway at present. We'll make a better way to reuse the resources (maybe cached client pools) to improve performance.

There will be a huge change of the microservice architecture in next version. And any suggestions about the architecture design is welcome :-)