Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua: global table to store state between threads #4027

Open
linux-china opened this issue Aug 1, 2018 · 7 comments
Open

Lua: global table to store state between threads #4027

linux-china opened this issue Aug 1, 2018 · 7 comments
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!

Comments

@linux-china
Copy link

Description:
Lua state is per worker and it will be non-trivial/impossible to share it between threads. A global storage for Lua is to provide a Lua API that wraps a metadata/table that calls into C++ code with proper locking to set/get items in a global table. All Lua code can access global table and share state in different Envoy Lua filters.

The original request is from #4008

@mattklein123 mattklein123 added enhancement Feature requests. Not bugs or questions. help wanted Needs help! labels Aug 1, 2018
@JulieMei325
Copy link

Is there any update on this feature support?

@kyessenov
Copy link
Contributor

Should Envoy have a generic mechanism for filters to share state between workers? This is a common concern.

@jplevyak
Copy link
Contributor

We have SharedData in C++. This acts like a global KV store.

@jplevyak
Copy link
Contributor

In the Proxy-Wasm C++ SDK.

@patrickcarnahan
Copy link

patrickcarnahan commented Feb 16, 2022

Any updates on this issue? Shared state in lua would negate a potential requirement to utilize c++ simply to achieve shared state.

@ggreenway
Copy link
Contributor

@patrickcarnahan nobody has showed interest in working on it or made a PR. But I don't think there's a technical reason not to do it.

@dxps
Copy link

dxps commented Oct 27, 2022

This is also available in proxy-wasm-rust SDK and others as well.

Now, before diving into understanding how this can be done, I am wondering: did anyone evaluate the response times of a Lua vs non-Lua (like Rust, which I'm using right now) implementation ❔

I'm planning to do this, except that I really wanted to use this set & get shared data feature. Without it in Lua, I think I can happily live with a Rust based implementation, but I'm still curios to see or do and have any comparison results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!
Projects
None yet
Development

No branches or pull requests

8 participants