-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Core Features
Zuul is built to work seamlessly with Eureka but can also be configured to work with static server lists or a discovery service of your choice.
The standard approach with a Eureka server would look like this:
### Load balancing backends with Eureka
eureka.shouldUseDns=true
eureka.eurekaServer.context=discovery/v2
eureka.eurekaServer.domainName=discovery${environment}.netflix.net
eureka.eurekaServer.gzipContent=true
eureka.serviceUrl.default=http://${region}.${eureka.eurekaServer.domainName}:7001/${eureka.eurekaServer.context}
api.ribbon.NIWSServerListClassName=com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
api.ribbon.DeploymentContextBasedVipAddresses=api-test.netflix.net:7001
In this configuration you have to specify your Eureka context and location. Given that, Zuul will automatically select the server list from Eureka with the given VIP for the api
Ribbon client. You can find more info about Ribbon configuration here.
To configure Zuul with a static server list or a different discovery provider, you'll have to keep the the listOfServers
property up to date:
### Load balancing backends without Eureka
eureka.shouldFetchRegistry=false
api.ribbon.listOfServers=100.66.23.88:7001,100.65.155.22:7001
api.ribbon.client.NIWSServerListClassName=com.netflix.loadbalancer.ConfigurationBasedServerList
api.ribbon.DeploymentContextBasedVipAddresses=api-test.netflix.net:7001
Notice in this configuration the server list class name is ConfigurationBasedServerList
instead of DiscoveryEnabledNIWSServerList
.
By default Zuul load balances using the ZoneAwareLoadBalancer from Ribbon. The algorithm is a round robin of the instances available in discovery, with availability zone success tracking for resiliency. The load balancer will keep stats for each zone and will drop a zone if the failure rates are above a configurable threshold.
If you want to use your own custom load balancer you can set the NFLoadBalancerClassName
property for that Ribbon client namespace or override the getLoadBalancerClass()
method in the DefaultClientChannelManager. Note that your class should extend DynamicServerListLoadBalancer.
Ribbon also allows you to configure the load balancing rule. For example, you can swap the RoundRobinRule
for the WeightedResponseTimeRule
, AvailabilityFilteringRule
, or your own rule.
You can find more details here.
A Netflix Original Production
Tech Blog | Twitter @NetflixOSS | Jobs
-
Zuul 2.x
-
Zuul 1.x