Depends on D5112
In response to this issue, we should implement the code that will delegate the work away from the reactors to separate threads. For this, I created a tool named Worker.
Differential D5068
[services] Rust Integration - c++ - Add worker • karol on Sep 6 2022, 7:21 AM. Authored by Tags None Referenced Files
Details Depends on D5112 In response to this issue, we should implement the code that will delegate the work away from the reactors to separate threads. For this, I created a tool named Worker. Services build as usual.
Diff Detail
Event Timeline
Comment Actions The Worker class is not that well-thought-through and I realize that. The first problem is that there's no limit to schedules, another one is that we don't have that much control over the threads - we join them but in the destructor, and this is basically a singleton with a static instance; that means it's going to be released when the app's about to terminate. We could maybe detach the threads... But all in all, I think that we should think about what is happening here and pursue more control over this "worker" aka "thread manager"/"thread pool". I know I do this too often but let's do a follow-up here (I guess you know what the circumstances are and why I keep creating the follow-up): https://linear.app/comm/issue/ENG-1760/implement-a-correct-thread-pool-in-c-for-reactors Comment Actions I'm not sure if this is the right approach. I would rather not have something that isn't well-though in the codebase - especially something which is in the core and touches threading stuff. The reason is that it's a lot cheaper to build something than to modify it, and if we decide to commit to this solution, which we know has a lot of issues, we're going to regret it. Additionally, if we know that this isn't good enough, we're not going to put it to production without the improvements, so there isn't too much point in pushing this. First of all, have you checked what are community's best practices in handling thread pooling in C++? Are there any libraries which are considered good? Can we use them directly or as an inspiration for our solution? Comment Actions I understand, you're right. The goal was to provide the POC asap so the performance tests would work. I'm going to look into the c++ thread pooling. Comment Actions I'm glad that you have decided to use a well recognized library and its thread pool implementation!
|