Fantom-foundation / go-opera

Opera blockchain protocol secured by the Lachesis consensus algorithm
https://fantom.foundation/
GNU Lesser General Public License v3.0
283 stars 283 forks source link

topicsdb: thread pool #414

Closed rus-alex closed 1 year ago

rus-alex commented 1 year ago

New constructor topicsdb.NewWithThreadPool() makes the same topicsdb.Index that by legacy topicsdb.New() but wrapped with threads-in-use limiter. It prevents the 'thread exhaustion' fail but leads to not full CPU/Mem utilization, i.e. more 'eth_getLogs' calls will be rejected by timeout. Const topicsdb.GoroutinesPerThread is for tuning.

( debug util is not included to product and can be found in https://github.com/Fantom-foundation/go-opera/tree/2d3ba7409e145242cf46a035fc22b8f5a9eebce0/cmd/pdb )