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

feat: fix oom bug #284

Merged
merged 6 commits into from
Apr 19, 2023
Merged

feat: fix oom bug #284

merged 6 commits into from
Apr 19, 2023

Conversation

georgehao
Copy link
Member

fix issue #268

@HAOYUatHZ
Copy link
Member

HAOYUatHZ commented Apr 18, 2023

@mask-pp uses sync.Pool to reduce GC pressure? Is that still the case?

related PRs:

Copy link
Member

@colinlyguo colinlyguo left a comment

Choose a reason for hiding this comment

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

LGTM

@colinlyguo colinlyguo self-requested a review April 18, 2023 11:25
@colinlyguo
Copy link
Member

colinlyguo commented Apr 18, 2023

@mask-pp uses sync.Pool to reduce GC pressure? Is that still the case?

related PRs:

@georgehao mentioned that it is due to the use of runtime.SetFinalizer, what was the reason for using it in the first place? And could we replace runtime.SetFinalizer with simple loggerResPool.Put(logRes)?

@mask-pp
Copy link

mask-pp commented Apr 18, 2023

In fact, use sync.Pool is a trade-off between memory resources and computing resources.
This way will increase gc pressure, but I'm not sure how much it will be affected, so making a pressure test to support the view is necessary.

Thegaram
Thegaram previously approved these changes Apr 19, 2023
@HAOYUatHZ
Copy link
Member

HAOYUatHZ commented Apr 19, 2023

In fact, use sync.Pool is a trade-off between memory resources and computing resources. This way will increase gc pressure, but I'm not sure how much it will be affected, so making a pressure test to support the view is necessary.

@georgehao can you do a benchmarking on CPU?

@georgehao
Copy link
Member Author

In fact, use sync.Pool is a trade-off between memory resources and computing resources. This way will increase gc pressure, but I'm not sure how much it will be affected, so making a pressure test to support the view is necessary.

I can understand your purpose to add sync.Pool for the structLog. But the way your add is not correct. this doesn't repeated
use the memory and may let memory can't be clean with gc.

@georgehao
Copy link
Member Author

image

you will see all the memory all held with sync.Pool.

@georgehao
Copy link
Member Author

In fact, use sync.Pool is a trade-off between memory resources and computing resources. This way will increase gc pressure, but I'm not sure how much it will be affected, so making a pressure test to support the view is necessary.

@georgehao can you do a benchmarking on CPU?

image

this image is i benchmark the scroll_getBlockTraceByNumberOrHash in staging, the usage cpu. the sync.Pool used can't resolve it.

image
I benchmark the scroll_getBlockTraceByNumberOrHash, get the flame graph. i found the high usage of cpu is not called by gc.

i will resolve the high usage cpu these days.

colinlyguo
colinlyguo previously approved these changes Apr 19, 2023
@colinlyguo
Copy link
Member

colinlyguo commented Apr 19, 2023

image

you will see all the memory all held with sync.Pool.

Would only using loggerResPool.Put(logRes) resolve this?

@georgehao
Copy link
Member Author

image
you will see all the memory all held with sync.Pool.

Would only using loggerResPool.Put(logRes) resolve this?

add sync.pool for structLog have a difficult. because the structLog is store in the array.

@georgehao
Copy link
Member Author

georgehao commented Apr 19, 2023

sync.Pool always resolve the CPU usage by gc. but currently, i analysis the flame graph, the cpu usage by gc is a little(5%). so use sync.Pool effect is not obvious. just remove it.
image

this flame graph is capture from the staging environment.

@HAOYUatHZ
Copy link
Member

HAOYUatHZ commented Apr 19, 2023

after updating https://github.com/scroll-tech/go-ethereum/blob/fix/debug_traceTransaction/params/version.go#L27 to 6 (so that version is 3.1.6) I think we can merge this

HAOYUatHZ
HAOYUatHZ previously approved these changes Apr 19, 2023
@colinlyguo
Copy link
Member

image
you will see all the memory all held with sync.Pool.

Would only using loggerResPool.Put(logRes) resolve this?

add sync.pool for structLog have a difficult. because the structLog is store in the array.

Thanks, I see now.

@HAOYUatHZ HAOYUatHZ dismissed stale reviews from colinlyguo, Thegaram, and themself via c130161 April 19, 2023 13:10
@HAOYUatHZ HAOYUatHZ merged commit f71fc67 into develop Apr 19, 2023
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.

5 participants