use workers pool in feature-extractor#193
Conversation
Feature extraction is CPU bound task. With increase of grpc workers it hits GIL. Signed-off-by: Maxim Sukharev <max@smacker.ru>
|
Performance testing: Server started with 30 grpc workers. 3000 calls with 30 concurrent requests: |
Signed-off-by: Maxim Sukharev <max@smacker.ru>
| } | ||
|
|
||
| def __init__(self, pool): | ||
| super(Service, self) |
There was a problem hiding this comment.
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.
| while True: | ||
| time.sleep(_ONE_DAY_IN_SECONDS) | ||
| except KeyboardInterrupt: | ||
| pool.terminate() |
There was a problem hiding this comment.
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.
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 <max@smacker.ru>
Feature extraction is CPU bound task.
With increase of grpc workers it hits GIL.