-
Notifications
You must be signed in to change notification settings - Fork 420
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
Profile only SequenceTransactions [NIT-2578] #2366
Conversation
Sorry, I forgot we adjusted the threshold to 2 seconds. Let's keep it at 2 seconds (but still limit it to only SequenceTransactions) |
…s/nitro into increase-profiling-threshold
No worries, changed to 2 seconds. |
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.
looks good, just few comment/log msgs need fixing + potentially could easily make .EnableProfiling hot-reloadable
execution/gethexec/sequencer.go
Outdated
block *types.Block | ||
err error | ||
) | ||
if s.enableProfiling { |
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.
Can we use config.EnableProfiling
here instead? Then we could make this option hot-reloadable.
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.
Good idea! Done.
Co-authored-by: Maciej Kulawik <10907694+magicxyyz@users.noreply.github.com>
Co-authored-by: Maciej Kulawik <10907694+magicxyyz@users.noreply.github.com>
…s/nitro into increase-profiling-threshold
execution/gethexec/sequencer.go
Outdated
block *types.Block | ||
err error | ||
) | ||
if s.config().EnableProfiling { |
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.
nit: we could use a config
copy that we already got in this scope to avoid calling the fetcher again
nitro/execution/gethexec/sequencer.go
Line 802 in 874bea0
config := s.config() |
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.
Done. Changed other methods as well where it's called more than once.
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.
there is one place that we need to use the fetcher
execution/gethexec/sequencer.go
Outdated
madeBlock = s.createBlock(ctx) | ||
} | ||
if madeBlock { | ||
nextBlock := time.Now().Add(config.MaxBlockSpeed) |
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.
here we need to get the config from the fetcher, it's called iteratively in a separate goroutine and we still want to hot-reload it
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.
Nice catch! Thanks!
(at this point I'm wondering how much overhead would fetching the config have if we were to never cache into a variable, since I can see how easy would it be to introduce a bug like this).
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.
hm... maybe the overhead is not that bad, but I'd still use the same config pointer for options that are e.g. thresholds and it might be good to keep them in sync (so as two or more of them are guaranteed to be taken from the same config object, without risk of reload race) - not sure if there are such sensitive options (?)
What do you think?
if s.config().ExpectedSurplusSoftThreshold != "default" && expectedSurplus < int64(s.config().expectedSurplusSoftThreshold) { | ||
log.Warn("expected surplus is below soft threshold", "value", expectedSurplus, "threshold", s.config().expectedSurplusSoftThreshold) | ||
config := s.config() | ||
if config.ExpectedSurplusSoftThreshold != "default" && expectedSurplus < int64(config.expectedSurplusSoftThreshold) { |
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.
this looks like an example when we need ExpectedSurplusSoftThreshold
and expectedSurplusSoftThreshold
read from the same config
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
No description provided.