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

Having multiple upstreams for single API endpoint in Kong #1129

Closed
harryparmar opened this issue Apr 6, 2016 · 14 comments
Closed

Having multiple upstreams for single API endpoint in Kong #1129

harryparmar opened this issue Apr 6, 2016 · 14 comments

Comments

@harryparmar
Copy link

Hi

I have question, I want to achieve if upstream route A is down automatically forward request to Route B. Is this possible? will this be achieved with #157
Any ideas when will this be implemented?
Been testing Kong and really like it. One thing I want to point out is Runscope plugin is prominently displayed in your Quickstart but config for it is missing in Constants.lua(Docker 0.7 version). In case some one follows your guide it wont be problem till Kong is running, problem will surface on restart where Docker for Kong will show running but with no service listening on ports 8000,8001, looking at Logs show Kong is not starting because of config missing for Runscope. I had to remove from cassandra plugin table manually Runscope plugin.

@Tieske
Copy link
Member

Tieske commented Apr 6, 2016

@harryparmar we're working on loadbalancing and one feature is going to be healthchecks.

Regarding the runscope problem you mentioned, would you mind opening a new issue for that and include some more details for us to investigate?

@Tieske
Copy link
Member

Tieske commented Apr 6, 2016

just to make sure; have you seen #1079 ? Please check whether it's the same issue before creating a new one

@harryparmar
Copy link
Author

Hi Tieske,

I see in your github, you have already fixed constant.lua file. I pulled docker image for 0.7 which at the time(last month) was missing runscope plugin and followed your quickstart guide to install Runscope plugin which created issue on Kong restart, maybe you have already fixed the docker version too? If not i will explain the problem and fix in detail in new issue,

@jimmytoan
Copy link

I have written a plugin for "multiple upstreams for single API endpoint".
My idea is using Consul Server for service discovery. My plugin use Lua Resty DNS to query SRV record from Consul Server. Example:

  • My Api is running on docker container (you can run many docker containers for 1 api), all containers register their services to Consul Server (with IP and port) by using Registrator container.
  • Point domain api1.abc.com to Kong Server.
  • Enable my plugin for this api.
  • When user send request to api1.abc.com , my plugin will query SRV record of this service and receive a list of SRV records (they are round robin from Consul).
  • After that, proxy user request to the IP and port of this service.

How do you think about this?

@harryparmar
Copy link
Author

Jimmy that sounds very clever, thanks for sharing. when your plugin receives records from consul do they contain dead servers as well? if it does, then do you forward request to dead server or request another from Consul? my main concern is in addition to doing basic load balancing but also picking intelligently alive server to forward request to.

@gomes
Copy link

gomes commented Apr 11, 2016

@harryparmar consul do health check https://www.consul.io/intro/getting-started/checks.html

@jimmypk are you planning to open your plugin?

@ahmadnassri ahmadnassri added the BC label May 13, 2016
@thibaultcha thibaultcha removed the BC label Sep 1, 2016
@gabel
Copy link

gabel commented Sep 15, 2016

@jimmypk I like the idea in general the DNS communication may cause a latency overhead that may be shipped around by using consul-template to configure nginx in kong.

@ghost
Copy link

ghost commented Jan 11, 2017

Just wondering where you stand on implementing load balancing? Is this implemented in Kong yet?

@thibaultcha
Copy link
Member

@FryDerm Load balancing has just started being implemented and the 0.10.0rc1 already has some capabilities regarding it (round-robin load balancing based on DNS records or manually specified "upstream targets").

See:
https://github.com/Mashape/kong/releases/tag/0.10.0rc1
#1735
Kong/docs.konghq.com#300

@ghost
Copy link

ghost commented Jan 11, 2017

@thibaultcha Thank you very much for your response. I look forward to checking it out.

@Tieske
Copy link
Member

Tieske commented Feb 13, 2017

load balancing implemented in 0.10, available in the RC. Remaining is a duplicate of #112 for healthchecks. Closing this.

@Tieske Tieske closed this as completed Feb 13, 2017
@IvanovOleg
Copy link

Please add a weighted routing policy to allow us to perform a Canary Releases

@Tieske
Copy link
Member

Tieske commented Mar 2, 2017

@IvanovOleg 0.10 also has upstream and target entities, which allow for more fine grained control. Additionally when using SRV dns records, it will use weighted round robin.

But for canary releases, traffic routing is only based on weights/volumes, not on any selection criterias (such as routing specific users or ip addresses)

@harshavardhanc
Copy link

harshavardhanc commented Nov 11, 2019

@IvanovOleg @thibaultcha Is this feature of having multiple upstreams for a single endpoint is available in 0.9?

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

No branches or pull requests

9 participants