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

Profile only SequenceTransactions [NIT-2578] #2366

Merged
merged 11 commits into from
Jun 5, 2024

Conversation

anodar
Copy link
Contributor

@anodar anodar commented Jun 3, 2024

No description provided.

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Jun 3, 2024
@anodar anodar changed the title Profile only SequenceTransactions, increase threshold to 5 sec Profile only SequenceTransactions, increase threshold to 5 sec [NIT-2578] Jun 3, 2024
@anodar anodar marked this pull request as ready for review June 3, 2024 19:03
@PlasmaPower
Copy link
Collaborator

Sorry, I forgot we adjusted the threshold to 2 seconds. Let's keep it at 2 seconds (but still limit it to only SequenceTransactions)

@anodar anodar changed the title Profile only SequenceTransactions, increase threshold to 5 sec [NIT-2578] Profile only SequenceTransactions [NIT-2578] Jun 4, 2024
@anodar
Copy link
Contributor Author

anodar commented Jun 4, 2024

No worries, changed to 2 seconds.

Copy link
Contributor

@magicxyyz magicxyyz left a 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/executionengine.go Outdated Show resolved Hide resolved
execution/gethexec/executionengine.go Outdated Show resolved Hide resolved
block *types.Block
err error
)
if s.enableProfiling {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Done.

anodar and others added 4 commits June 4, 2024 17:32
Co-authored-by: Maciej Kulawik <10907694+magicxyyz@users.noreply.github.com>
Co-authored-by: Maciej Kulawik <10907694+magicxyyz@users.noreply.github.com>
@anodar anodar requested a review from magicxyyz June 4, 2024 15:37
block *types.Block
err error
)
if s.config().EnableProfiling {
Copy link
Contributor

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

config := s.config()

Copy link
Contributor Author

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.

@anodar anodar requested a review from magicxyyz June 5, 2024 08:46
Copy link
Contributor

@magicxyyz magicxyyz left a 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

madeBlock = s.createBlock(ctx)
}
if madeBlock {
nextBlock := time.Now().Add(config.MaxBlockSpeed)
Copy link
Contributor

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

Copy link
Contributor Author

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).

Copy link
Contributor

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?

@anodar anodar requested a review from magicxyyz June 5, 2024 12:45
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) {
Copy link
Contributor

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

Copy link
Contributor

@magicxyyz magicxyyz left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower merged commit 1bb0cd2 into master Jun 5, 2024
11 of 12 checks passed
@PlasmaPower PlasmaPower deleted the increase-profiling-threshold branch June 5, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants