-
Notifications
You must be signed in to change notification settings - Fork 16
use workers pool in feature-extractor #193
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
Conversation
Feature extraction is CPU bound task. With increase of grpc workers it hits GIL. Signed-off-by: Maxim Sukharev <[email protected]>
|
Performance testing: Server started with 30 grpc workers. 3000 calls with 30 concurrent requests: |
Signed-off-by: Maxim Sukharev <[email protected]>
| } | ||
|
|
||
| def __init__(self, pool): | ||
| super(Service, self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you that this is working? This should be:
| super(Service, self) | |
| super(Service, self).__init__() |
Maybe it works because in the service_pb2_grpc.FeatureExtractorServicer class the init is actually a noop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♀️ fixed
| while True: | ||
| time.sleep(_ONE_DAY_IN_SECONDS) | ||
| except KeyboardInterrupt: | ||
| pool.terminate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be called for exceptions different from KeyboardInterrupt. Actually I don't know whether it is going to leak some resources. Maybe you could use this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All sub-processes are created using fork. Operation system is going to take care of cleaning up when the server exits. So it's not a big deal. Also, we run feature-extractor in the container and any exit would cause restart of the container which would clean-up everything.
I don't think we need to improve termination here as long as we don't have any real issue with how it works right now.
Signed-off-by: Maxim Sukharev <[email protected]>
Feature extraction is CPU bound task.
With increase of grpc workers it hits GIL.