envoyproxy/envoy

Proxy-WASM: Controlling contexts in other threads

Open

#17,576 建立於 2021年8月3日

在 GitHub 查看
 (20 留言) (0 反應) (0 負責人)C++ (5,373 fork)batch import
area/wasmhelp wanted

倉庫指標

Star
 (27,997 star)
PR 合併指標
 (平均合併 8天) (30 天內合併 378 個 PR)

描述

Hi, there maintainers/authors!

I'm working on building a WASM filter for my GSoC'21 project under the mentorship of @unleashed which is using shared data as a cache. Whenever a new request comes whose info is not present in the cache - the proxy does a callout to fetch information from an external service. Taking into account the environment in which this filter will be used, there can be multiple concurrent identical requests (i.e targeting a single key in the shared data). Right now, there is no way to avoid multiple callouts from different threads at the same time. We thought of adding an identifier in the cache signaling other identical requests in different threads about the outbound callout but there is no ability to pause and resume after the response.

Is there a way to achieve this behavior in the current proxy-wasm state? or does it require changes in the host?

Pictorial presentation:

                                 callout
                                    ▲           response
                      Cache miss    │              │
Thread(T1) R1(Key=1)────────────────┘              ▼ ──── on_http_call_response called

Thread(T2) R2(Key=1)─────────── (paused).........   ───── **No Event Present**

Thread(T3) R3(Key=1)─────────── (paused).........   ───── **No Event Present**

SDK: Rust v0.1.4

cc @PiotrSikora @mathetake @NomadXD

貢獻者指南