-
Notifications
You must be signed in to change notification settings - Fork 58
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
parallelized lua script execution with serialized output #1613
Conversation
This currently spawns a goroutine for each message. It could be optimized to only spawn 1 goroutine per lua.LState (edit: optimized in commit removing puddle) |
} | ||
|
||
func LuaPoolJob(ctx context.Context, pool LPool, wait <-chan struct{}, f func(*lua.LState, <-chan struct{})) (chan struct{}, error) { | ||
res, err := pool.Acquire(ctx) | ||
func (pool *LPool[T]) Spawn() 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.
While it'd be fine to spin up a constant N goroutines, the correct amount will depend on the script, making it better to specify that kind of knob on the mirror instead of environment
Instead Spawn is called when messages aren't being waited on, this way an environment can set parallelism to some good amount for the vcores available & fast scripts will only create as many goroutines as necessary to keep up with record ingestion
51e0b76
to
651060f
Compare
No description provided.