Closed emmanueldenloye closed 3 years ago
The nested concurrent traversals here are pretty concerning. When I print the size of the inner structuring we're traversing over concurrently for an empty DB I get this:
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 2797 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
2021-08-05T13:38:26.860Z [Debug] [] Traversing concurrently over 5164 ranges
So it seems like this will be creating something along the lines of 80,000 threads. Even though these are lightweight green threads, that seems like WAY too many. I would say a fixed configurable number of worker threads or a simple one thread per chain would make more sense to me.
When I run this
gaps
it doesn't seem to feel all the gaps that it says exist.Then when I run it again right away I get this.
Comparing the two...
So somehow the whole gaps isn't getting filled. This violates an invariant that I would expect it to have.