Skip to content

feat: add Lua GC flags #5194

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

Merged
merged 7 commits into from
Jun 4, 2025
Merged

feat: add Lua GC flags #5194

merged 7 commits into from
Jun 4, 2025

Conversation

BorysTheDev
Copy link
Contributor

I've added 2 flags:

  • luagc - to tune lua gc
  • lua_mem_usage_force_gc - to do force GC

I have done some tests with lua_mem_usage_force_gc, and it shows quite good results to my mind, and it works fast.
Regarding the luagc flag, I've tried to use different parameters, according to https://www.lua.org/manual/5.4/manual.html#2.5.1 , and the results were insignificant, but with aggressive parameters performance can be dropped significantly

@BorysTheDev BorysTheDev requested review from romange and kostasrim May 28, 2025 10:25
@@ -1109,6 +1203,16 @@ Interpreter* InterpreterManager::Get() {
}

void InterpreterManager::Return(Interpreter* ir) {
static const uint64_t max_memory_usage = absl::GetFlag(FLAGS_lua_mem_usage_force_gc);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would imagine we would like to change these flags without restarting the process.
please add support to "CONFIG SET" as well.

@@ -821,6 +821,8 @@ void Service::Init(util::AcceptServer* acceptor, std::vector<facade::Listener*>

config_registry.RegisterMutable("pipeline_squash");

config_registry.RegisterMutable("lua_mem_usage_force_gc");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's won't cut it and you have not tested that it works.
you used static const uint64_t max_memory_usage = ... so it will be initialised only once

@BorysTheDev BorysTheDev enabled auto-merge (squash) June 4, 2025 13:20
@BorysTheDev BorysTheDev merged commit 83bff79 into main Jun 4, 2025
10 checks passed
@BorysTheDev BorysTheDev deleted the LuaGCFlags branch June 4, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants