Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support client-side load-balancing with Eureka and GRPC Java. #3

Closed
wants to merge 1 commit into from

Conversation

imberda
Copy link

@imberda imberda commented Oct 31, 2017

No description provided.

@imberda
Copy link
Author

imberda commented Oct 31, 2017

To verify load-balancing start 2 instances of the server with the "server1" and "server2" profiles respectively. This will allow each to listen on different ports locally. The books response now contains the server name that served the request (ie. server-#).

To verify correct load-balancing, you can start and stop the servers and watch as the requests route to one or both of the servers depending on availability. Interestingly GRPC automatically handles bad nodes and re-routes away from unavailable nodes which are still listed as addresses by the name resolver. So nodes that go down are immediately taken offline by GRPC when a request fails.

Conversely GRPC only knows about newly active nodes when notified by the name resolver. This only happens when the name resolver is updated by an event. This depends on the cache update frequency configured for Eureka. Typically this is within 30 seconds.

@szantopeter
Copy link
Member

Hi @imberda ,

I created a separate project for the grpc-eureka library here :

https://github.com/ExampleDriven/grpc-eureka-java

This is an open source reusable library that I published to maven central. I kept this project as a "reference implementation". The only problem is it conflicts with your change :( Your PR is quite nice, would you mind reapplying it to the new structure? I have only one comment :

I tried to limit the number of transitive dependencies that comes with grpc-eureka-java as much as possible. I noticed that you use lombok, is it essential?

Thanks

Peter

@imberda
Copy link
Author

imberda commented Nov 1, 2017

Sure I don't mind migrating the change to the dedicated project. Should be able to do this over the next few day...

However one thought crossed my mind regarding security. In serious (i.e. real-world) usage the ManagedChannel would use TLS. However I think the solution will have problems as the authority supplied is the logical service name and the connections will be made to the instance nodes. This means that the authority will be something like MY-SERVICE and the certificates presented will contain node1.domain.com.

This issue is described at this issue: grpc/grpc-java#2662

There are some suggested approaches in the link above. Just wanted to get your thoughts on how to approach?

@szantopeter
Copy link
Member

hmm, interesting question, I don't know the answer, it should be tested to understand how it works. If you want I can add a docker and docker compose to the reference implementation project next week, it helps testing such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants