Skip to content

Unique identifiers of worker contexts in multithreaded environment #78

Open
@vchigrin

Description

@vchigrin

Following сomment relates to Envoy proxy (I don't know much about other proxy-wasm implementations).

Multi-threaded servers may use separate WASM runtime for each worker thread. At least in Envoy identifiers, provided in proxy_on_context_create are unique for that worker thread (that is, in simplest scenario, all root contexts will get identifier equal to 1). Thus it impossible to distinguish instances of the HTTP filter contexts, running on different threads.

Why users may want distinguish them: Suppose system where some plugin has one context marked as singleton (registered in bootstrap_extensions config section), and multiple contexts registered as HTTP filter. If singleton context wants send data to worker contexts, then each worker context must have some unique shared queue name (since as far as I can see, proxy_on_queue_ready notifications will arrive to those instance that made most recent call to proxy_register_shared_queue ). There are no simple way for generating such unique queue names for HTTP filter context instance in each worker thread.

I think providing identifier unique for entire proxy process will help solve this issue.

If I missed something and proxy-wasm API already have ways for accomplishing this task, I will be very grateful is somebody points to them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions