Skip to content

Add treapNode pool. Reduce cloneTreapNode() allocations.#47

Closed
moodyjon wants to merge 3 commits intolbryio:masterfrom
moodyjon:treap_node_pool
Closed

Add treapNode pool. Reduce cloneTreapNode() allocations.#47
moodyjon wants to merge 3 commits intolbryio:masterfrom
moodyjon:treap_node_pool

Conversation

@moodyjon
Copy link
Collaborator

@moodyjon moodyjon commented Jun 3, 2022

Unbundled from PR #43

See that for usage/testing.

Based on work by @BrannonKing in mem_pressure_try_2 and reduce_memory_pressure.

I am not entirely comfortable with the changes. It's my best attempt to combine original Immutable treap semantics with the way that ffldb/transaction actually wants to use it. I was very successful in reducing temporary allocations, but I'm still not sure it's safe. It could also be fragile if treap is used in different ways in the future.

BrannonKing and others added 3 commits June 3, 2022 11:47
…Mutable

treap recycle nodes consistently. Rework Immutable treap node recycling
attempting to make it safer in the presence of code that takes snapshots
(dbCacheSnapshot) of the treap. Add special mutable PutM and DeleteM
methods which DB transaction can use to apply changes more efficiently
without creating lots of garbage memory.
@roylee17
Copy link
Collaborator

roylee17 commented Jul 7, 2022

It seems the changes doesn't translate to the performance in terms of sync time, and memory pressure.
I rebased this changes onto v10.22.102 and did a full sync compare to it. Both took around 12 hours for sync up to 1070K blocks with 5.1 GB memory usage. So I'm inclining to leave this out.

Note:

Currently we, include your contributions, have made a lot efforts to improve performance, and make the user/developer experience much better. And I suspect further tuning would have to involve more deeper and intrusive changes with marginal gain.

With limited bandwidth, we're prioritizing functional parity/compatibility with lbrycrd, and help users migrate to lbcd. Check the RPC Availability page, which tracks the full list of bitcoin-core v22.0.0 RPCs. Those with open issues are reported by users that are missing or have different attributes from lbrycrd.

If interested, we can discuss more on discord ping me @roylee17 or join #lbcd channel.

@moodyjon
Copy link
Collaborator Author

moodyjon commented Jul 8, 2022

I'm OK with closing this. It seems likely that network latency/throughput is the controlling factor. Blocks are processed serially during network sync, using a fraction of one CPU. As long as there is some CPU headroom (e.g. second CPU core), the garbage collector is able to run in a second thread without much effect on network sync time.

@moodyjon moodyjon closed this Jul 8, 2022
@moodyjon
Copy link
Collaborator Author

moodyjon commented Jul 8, 2022

If interested, we can discuss more on discord ping me @roylee17 or join #lbcd channel.

I don't see an #lbcd on the discord server. All I see is a generic #developers. Is there a second server?

@roylee17
Copy link
Collaborator

roylee17 commented Jul 8, 2022

Myself is not very familiar with discord yet. But here's the link, see if that works.

https://discord.gg/KRh5Gdjh

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.

3 participants