ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.31k stars 1.63k forks source link

#1811 #1804 Load balancer sample using Consul and Least Connection #1860

Closed ks1990cn closed 6 months ago

ks1990cn commented 8 months ago

Closes #1811

LoadBalancer Sample using Consul and Least Connection type.

I am creating this PR as a handy guide for local setup and running so any contributor can see loadbalancer in action with minimal repeated setup.

I think this can also help me / anyone as always present setup so just quickly go and make required changes to debug any requested changes / bug.

Proposed Changes

ks1990cn commented 8 months ago

@ggnaegi @raman-m Please check if folder structure looks fine to you.

@ggnaegi Please help me with your last suggestion - Only one downstream API can be used to demo load balancer. In docker-compose which service instance is mentioned on first gets started based on docker image.

While my services are running in docker, unable to find my services being registered in Consul.

raman-m commented 8 months ago

Tanmay, I'm glad that you're so productive developer who creates 3 PRs. Hope we will deliver this PR next year... It's a joke! In January'24 for sure. :wink:

I will review after the Nov'23 release... sorry!

ks1990cn commented 8 months ago

@raman-m @ggnaegi Are you done with Nov release?

raman-m commented 8 months ago

No! Nov-Dec'23 release is still ongoing... Watch for the progress in Nov-December'23 milestone

raman-m commented 6 months ago

@ks1990cn commented on Jan 12:

Are you done with Nov release?

Yes, we've released version 23.0 on Feb 13, 4 days ago.

raman-m commented 6 months ago

Tanmay, What do you think is the readiness of this PR in %? Can I review and invite other reviewers?

ks1990cn commented 6 months ago

Hi @raman-m ,

For this PR, @ggnaegi was suggesting that from single downstream API and using docker image for that api can demo multiple container instance and load balance it.

My previous idea was to have two downstream apis and one api for gateway to demo it. In this way I was able to demo two instances of apis.

Probably I need idea that @ggnaegi was suggesting.

Waiting to start again with you guys😬

raman-m commented 6 months ago

@ggnaegi @RaynaldM What is Tanmay doing with his PR? 🤯 He doesn't respect our code reviews...

raman-m commented 6 months ago

@ks1990cn commented 2 days ago:

For this PR, @ggnaegi was suggesting that from single downstream API and using docker image for that api can demo multiple container instance and load balance it.

Absolutely! Only Docker in compose configuration. Our old Samples have the same design issue: they must be refactored with Docker Compose configuration.

What was the problem just to include new Docker files? Why to close PR? If your new PR will be on the top of PRs list that does not mean your new PR will be merged first. 🤣 It depends on PR readiness to deliver only.

ks1990cn commented 6 months ago

@raman-m I got problem with my dev branch with my fork. And I forked again. So PRs got closed due to head got deleted for them.

Problem with dev : I got 4-5 commits ahead of main branch and sync was saying I am upto date and I was not able to see your recent changes. Quite weird thing happened.

Usually, I just sync my develop & merge it to my working branch so code gets upto date!

raman-m commented 6 months ago

Very interesting story with fork deletion! Please write more fairy tales. ))

raman-m commented 6 months ago

Nothing mysterious! Just hash values of commits were changed after force pushing, after feature branch rebasing (on origin). After that your local repo commits have different hash values. To fix that you had to delete and checkout the branch, nothing more!

git switch develop
git branch -D loadbalancer
git fetch --all
git checkout loadbalancer