hyperioxx / frontman

Frontman is an open-source API gateway written in Go that allows you to manage your microservices and expose them as a single API endpoint. It acts as a reverse proxy and handles requests from clients, routing them to the appropriate backend service.
https://frontman-labs.github.io/frontman/
GNU General Public License v3.0
5 stars 0 forks source link

Simplify client handling and reduce concurrency latency by embedding the client in the BackendService struct #103

Closed hyperioxx closed 1 year ago

hyperioxx commented 1 year ago

Currently, the client map is accessed concurrently, which introduces latency due to mutex locks. It appears that there is a 1-to-1 relationship between clients and backend services. Embedding the client directly in the BackendService struct could simplify the code and avoid the concurrent access latency.

By embedding the client in the BackendService struct, it would also be easier to refresh clients, as we would only need to iterate over the BackendService instances instead of reconciling the client map and the BackendService instances.

Proposed Solution

hyperioxx commented 1 year ago

@CCOLLOT @amityahav

amityahav commented 1 year ago

Sorry but I'm not fully understand why there is need for refreshing the clients? @hyperioxx

hyperioxx commented 1 year ago

@amityahav So that the user can dynamically change things like timeout etc without restarting the whole server

amityahav commented 1 year ago

@hyperioxx so that's not really needed as we will modify the conf of the clients when modifying the service via the api

hyperioxx commented 1 year ago

@amityahav Your right ! the api has access, so lets get rid of it