-
Notifications
You must be signed in to change notification settings - Fork 923
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
improve lua vm executing with pool #2864
Conversation
/assign |
Is the increase in memory consumption related to the pool size of the lua VM? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~ Can we use this lua VM in the karmadactl interpret
command?
/lgtm
/cc @RainbowMango @jameszhangyukun
@XiShanYongYe-Chang: GitHub didn't allow me to request PR reviews from the following users: jameszhangyukun. Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Looks great!
Does #2824 depend on it? |
Yes. The pool size shall be balanced between memory and cpu cost. But now I have no sufficient evidences which is best.
|
In interpret command, we only call vm once, it's no need to use VM pool. So these 2 PRs has no relations |
/assign @RainbowMango |
} | ||
|
||
// NewInstance creates a new lua VM | ||
func (vm *VM) NewInstance() (*lua.LState, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewInstance
is not going to create a new lua VM
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Signed-off-by: yingjinhui <yingjinhui@didiglobal.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: yingjinhui yingjinhui@didiglobal.com
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
At present, we create a new Lua vm to run script for every calling. This pr create vm once, before running script, get vm from pool, reducing the cost of vm creating.
I test it with a demo, calling the script every 10ms:
and implements
GetReplicas
in two ways:luavm1
podluavm2
podEven in
luavm2
cost little more memory(48M v.s. 36M), but has much less in CPU (0.03 v.s. 0.1)Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: