Convert Figma logo to code with AI

Netflix logozuul

Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.

13,421
2,367
13,421
207

Top Related Projects

An API Gateway built on Spring Framework and Spring Boot providing routing and more.

38,788

🦍 The Cloud-Native API Gateway and AI Gateway.

24,693

Cloud-native high-performance edge/middle/service proxy

50,061

The Cloud Native Application Proxy

14,277

The Cloud-Native API Gateway

Quick Overview

Zuul is an edge service gateway developed by Netflix that provides dynamic routing, monitoring, resiliency, and security for cloud-based applications. It acts as an intermediary for all inbound requests, applying a set of pre-filters for authentication, routing, and more before forwarding requests to the appropriate backend services.

Pros

  • Highly customizable with a flexible filter mechanism
  • Supports dynamic routing and load balancing
  • Integrates well with other Netflix OSS components like Eureka and Ribbon
  • Provides built-in support for authentication and security

Cons

  • Steep learning curve for newcomers to the Netflix OSS ecosystem
  • Can introduce additional latency if not configured properly
  • Limited documentation and community support compared to some alternatives
  • Requires significant setup and configuration for optimal performance

Code Examples

  1. Basic Zuul filter:
public class SimpleFilter extends ZuulFilter {
    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 1;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        ctx.addZuulRequestHeader("X-Custom-Header", "CustomValue");
        return null;
    }
}

This example shows a basic Zuul pre-filter that adds a custom header to all incoming requests.

  1. Route configuration in application.yml:
zuul:
  routes:
    users:
      path: /users/**
      serviceId: user-service
    orders:
      path: /orders/**
      serviceId: order-service

This YAML configuration defines routes for two services, mapping URL paths to specific microservices.

  1. Enabling Zuul proxy in a Spring Boot application:
@EnableZuulProxy
@SpringBootApplication
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}

This code snippet shows how to enable Zuul proxy functionality in a Spring Boot application.

Getting Started

To get started with Zuul:

  1. Add Zuul dependency to your project:

    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-zuul'
    
  2. Enable Zuul proxy in your main application class:

    @EnableZuulProxy
    @SpringBootApplication
    public class GatewayApplication {
        public static void main(String[] args) {
            SpringApplication.run(GatewayApplication.class, args);
        }
    }
    
  3. Configure routes in application.yml:

    zuul:
      routes:
        example-service:
          path: /api/**
          serviceId: example-service
    
  4. Implement custom filters as needed by extending ZuulFilter class.

Competitor Comparisons

An API Gateway built on Spring Framework and Spring Boot providing routing and more.

Pros of Spring Cloud Gateway

  • Built on Spring Framework 5, Project Reactor, and Spring Boot 2.0, offering better performance and non-blocking architecture
  • Provides more flexible and powerful routing capabilities with Predicates and Filters
  • Supports WebSocket and can integrate with Spring Security for authentication and authorization

Cons of Spring Cloud Gateway

  • Steeper learning curve, especially for developers not familiar with reactive programming
  • Less mature compared to Zuul, with potentially fewer community resources and third-party integrations
  • May require more configuration and setup for complex scenarios

Code Comparison

Spring Cloud Gateway route configuration:

spring:
  cloud:
    gateway:
      routes:
        - id: example_route
          uri: https://example.com
          predicates:
            - Path=/example/**

Zuul route configuration:

zuul:
  routes:
    example:
      path: /example/**
      url: https://example.com

Both Spring Cloud Gateway and Zuul are popular API gateway solutions, but they differ in architecture and features. Spring Cloud Gateway is newer and built on a reactive stack, offering potentially better performance for high-concurrency scenarios. Zuul, being older and more established, has a larger community and more extensive documentation. The choice between them often depends on specific project requirements and team expertise.

38,788

🦍 The Cloud-Native API Gateway and AI Gateway.

Pros of Kong

  • More extensive plugin ecosystem with over 100 plugins available
  • Supports multiple protocols including HTTP, gRPC, and WebSockets
  • Better performance and scalability for high-traffic scenarios

Cons of Kong

  • Steeper learning curve due to more complex configuration
  • Requires a separate database (PostgreSQL or Cassandra) for storing configuration
  • Commercial support and some advanced features require paid enterprise version

Code Comparison

Kong configuration example:

http {
  upstream backend {
    server backend1.example.com;
    server backend2.example.com;
  }
  server {
    listen 80;
    location / {
      proxy_pass http://backend;
    }
  }
}

Zuul configuration example:

zuul:
  routes:
    users:
      path: /users/**
      url: http://users-service
    orders:
      path: /orders/**
      url: http://orders-service

Both Kong and Zuul serve as API gateways, but they have different strengths and use cases. Kong offers more flexibility and features out of the box, making it suitable for complex, high-traffic environments. Zuul, being part of the Netflix OSS stack, integrates well with other Netflix components and is simpler to set up for basic routing scenarios. The choice between the two depends on specific project requirements, existing infrastructure, and team expertise.

24,693

Cloud-native high-performance edge/middle/service proxy

Pros of Envoy

  • More extensive protocol support (HTTP/1, HTTP/2, gRPC, TCP, UDP)
  • Advanced load balancing features and traffic management capabilities
  • Better performance and lower latency due to C++ implementation

Cons of Envoy

  • Steeper learning curve and more complex configuration
  • Less integrated with Spring Cloud ecosystem
  • Requires more resources to run compared to Zuul

Code Comparison

Zuul configuration (Java):

@EnableZuulProxy
@SpringBootApplication
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}

Envoy configuration (YAML):

static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 8080
  clusters:
  - name: service_backend
    connect_timeout: 0.25s
    type: STRICT_DNS
    lb_policy: ROUND_ROBIN
    hosts:
    - socket_address:
        address: backend.example.com
        port_value: 443

The code comparison shows that Zuul is more tightly integrated with Spring Boot, while Envoy uses a YAML configuration file for setup. Envoy's configuration is more verbose but offers finer-grained control over routing and load balancing.

50,061

The Cloud Native Application Proxy

Pros of Traefik

  • Built-in service discovery and automatic configuration
  • Native support for Docker and other container orchestration platforms
  • Real-time configuration changes without restarts

Cons of Traefik

  • Steeper learning curve for complex configurations
  • Less mature ecosystem compared to Zuul
  • May have higher resource usage in some scenarios

Code Comparison

Traefik configuration (YAML):

http:
  routers:
    my-router:
      rule: "Host(`example.com`)"
      service: my-service
  services:
    my-service:
      loadBalancer:
        servers:
          - url: "http://localhost:8080"

Zuul configuration (Properties):

zuul.routes.my-route.path=/api/**
zuul.routes.my-route.url=http://localhost:8080

Traefik offers a more declarative and flexible configuration approach, while Zuul's configuration is simpler but less powerful. Traefik's built-in features often require less code for advanced scenarios, whereas Zuul may need additional components or custom code for similar functionality.

Both projects serve as API gateways and reverse proxies, but Traefik is more focused on modern, container-based architectures, while Zuul is deeply integrated with the Spring Cloud ecosystem. The choice between them depends on your specific infrastructure needs and existing technology stack.

14,277

The Cloud-Native API Gateway

Pros of APISIX

  • More active development with frequent updates and releases
  • Supports multiple programming languages and protocols
  • Offers a wider range of plugins and extensibility options

Cons of APISIX

  • Steeper learning curve due to more complex architecture
  • Requires additional components like etcd for configuration storage

Code Comparison

APISIX route configuration:

local _M = {
    version = 0.1,
    priority = 0,
    name = "example-plugin",
    schema = {
        type = "object",
        properties = {
            key = {type = "string"}
        }
    },
}

Zuul route configuration:

zuul:
  routes:
    users:
      path: /myusers/**
      serviceId: users_service
    stores:
      path: /mystore/**
      serviceId: stores_service

APISIX offers more flexibility in route configuration using Lua, while Zuul uses a simpler YAML-based approach. APISIX's configuration allows for more complex logic and custom plugins, whereas Zuul's configuration is more straightforward but less customizable.

Both projects serve as API gateways, but APISIX provides a more feature-rich and extensible solution at the cost of increased complexity. Zuul, being part of the Netflix OSS stack, integrates well with other Netflix components but may have limitations in terms of protocol support and extensibility compared to APISIX.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Snapshot

Zuul

Zuul is an L7 application gateway that provides capabilities for dynamic routing, monitoring, resiliency, security, and more. Please view the wiki for usage, information, HOWTO, etc https://github.com/Netflix/zuul/wiki

Here are some links to help you learn more about the Zuul Project. Feel free to PR to add any other info, presentations, etc.


Articles from Netflix:

Zuul 1: http://techblog.netflix.com/2013/06/announcing-zuul-edge-service-in-cloud.html

Zuul 2:

https://netflixtechblog.com/open-sourcing-zuul-2-82ea476cb2b3

https://netflixtechblog.com/zuul-2-the-netflix-journey-to-asynchronous-non-blocking-systems-45947377fb5c

https://netflixtechblog.com/the-show-must-go-on-securing-netflix-studios-at-scale-19b801c86479


Netflix presentations about Zuul:

Strange Loop 2017 - Zuul 2: https://youtu.be/2oXqbLhMS_A

AWS re:Invent 2018 - Scaling push messaging for millions of Netflix devices: https://youtu.be/IdR6N9B-S1E


Slides from Netflix presentations about Zuul:

http://www.slideshare.net/MikeyCohen1/zuul-netflix-springone-platform

http://www.slideshare.net/MikeyCohen1/rethinking-cloud-proxies-54923218

https://github.com/strangeloop/StrangeLoop2017/blob/master/slides/ArthurGonigberg-ZuulsJourneyToNonBlocking.pdf

https://www.slideshare.net/SusheelAroskar/scaling-push-messaging-for-millions-of-netflix-devices


Projects Using Zuul:

https://cloud.spring.io/

https://jhipster.github.io/


Info and examples from various projects:

https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul

http://www.baeldung.com/spring-rest-with-zuul-proxy

https://blog.heroku.com/using_netflix_zuul_to_proxy_your_microservices

http://blog.ippon.tech/jhipster-3-0-introducing-microservices/


Other blog posts about Zuul:

https://engineering.riotgames.com/news/riot-games-api-fulfilling-zuuls-destiny

https://engineering.riotgames.com/news/riot-games-api-deep-dive

http://instea.sk/2015/04/netflix-zuul-vs-nginx-performance/


How to release Zuul

This project uses a GitHub Action workflow for publishing a new release. The workflow is triggered by a Git tag.

git checkout master
git tag vX.Y.Z
git push --tags