Description
Thanks, @rmk135. I managed to get it work with some refactoring. The issue was not related to spawn but Gunicorn.
I found out that the performance of a CLI tool we built using dependency-injector became significantly slower after using register_loader_containers
. The code seems to perform a wire
operation on each module import. Is the performance degradation expected?
CLI timing with wire
:
bentoml list 1.81s user 0.59s system 128% cpu 1.866 total
bentoml list 1.82s user 0.55s system 129% cpu 1.835 total
bentoml list 1.79s user 0.53s system 129% cpu 1.797 total
CLI timing with register_loader_containers
:
bentoml list 4.17s user 0.53s system 114% cpu 4.117 total
bentoml list 4.14s user 0.51s system 116% cpu 4.001 total
bentoml list 4.13s user 0.51s system 116% cpu 3.982 total
Originally posted by @ssheng in #441 (comment)
Need to check if there is a way to make a performance optimization for wiring. register_loader_containers()
.
Also need to keep question #437 in the context.