Rewrite of mercury for better performance.
This commit is contained in:
1 parent
3005dfdc0f
commit
fa2a2e2107
60 files changed
+971
-1255
No files matched your search
@@ -6,8 +6,7 @@
|
||||
#include "lib/config/protos/orderman_cfg.pb.h"
|
||||
#include "lib/md/MDConsumer.h"
|
||||
#include "lib/mercury/actors/Timer.h"
|
||||
#include "lib/mercury/broker/AsyncEventBroker.h"
|
||||
#include "lib/mercury/mercury_utils/Executor.h"
|
||||
#include "lib/mercury/executor/Executor.h"
|
||||
#include "lib/metrics/metrics.h"
|
||||
#include "lib/orderman/actors/AsyncFactory.h"
|
||||
#include "lib/orderman/actors/ExecutionGateway.h"
|
||||
@@ -27,8 +26,7 @@ namespace orderman {
|
||||
|
||||
struct ActorThread {
|
||||
ActorThread(const config::OrdermanCfg::OrdermanThread &cfg,metrics::MetricsContainer &stats)
|
||||
: cfg(cfg), thread(), event_broker(new mercury::AsyncEventBroker()),
|
||||
executor(*event_broker), loop_metric(), done(false) {
|
||||
: cfg(cfg), thread(), executor(), loop_metric(), done(false) {
|
||||
std::array<double, 30> buckets;
|
||||
auto i = 0;
|
||||
for (auto &b : buckets)
|
||||
@@ -78,7 +76,6 @@ struct ActorThread {
|
||||
|
||||
config::OrdermanCfg::OrdermanThread cfg;
|
||||
std::thread thread;
|
||||
std::shared_ptr<mercury::AsyncEventBroker> event_broker;
|
||||
mercury::Executor executor;
|
||||
std::shared_ptr<metrics::HistogramMetric<30>> loop_metric;
|
||||
std::atomic<bool> done;
|
||||
@@ -104,7 +101,7 @@ struct OrderServiceServer::PImpl {
|
||||
admin_service(ctx.locate<api::admin::AdminService>()), md_consumer(ss),
|
||||
stats(stats) {}
|
||||
|
||||
std::shared_ptr<ServiceBridge> service_bridge;
|
||||
ServiceBridge* service_bridge;
|
||||
|
||||
std::vector<std::unique_ptr<ActorThread>> actor_threads;
|
||||
|
||||
@@ -128,7 +125,7 @@ OrderServiceServer::OrderServiceServer(
|
||||
me->publish_orders = make_orders_publisher();
|
||||
me->publish_fills = make_fills_publisher();
|
||||
|
||||
me->service_bridge = std::make_shared<ServiceBridge>(
|
||||
me->service_bridge = new ServiceBridge(
|
||||
[this]() { me->service_ready = true; },
|
||||
|
||||
[this, &ctx](auto const &orders) {
|
||||
@@ -139,15 +136,15 @@ OrderServiceServer::OrderServiceServer(
|
||||
ctx.post([this, fill] { this->on_fills(fill); });
|
||||
});
|
||||
|
||||
std::vector<mercury::IEventBrokerPtr> all_brokers;
|
||||
std::vector<mercury::Executor*> all_executors;
|
||||
for (auto const &thread_cfg : config::get<config::OrdermanCfg>().thread()) {
|
||||
auto at = std::make_unique<ActorThread>(thread_cfg,stats);
|
||||
all_brokers.push_back(at->event_broker);
|
||||
all_executors.push_back(&at->executor);
|
||||
me->actor_threads.push_back(std::move(at));
|
||||
}
|
||||
|
||||
for (auto &t : me->actor_threads)
|
||||
t->event_broker->init_neighbours(all_brokers);
|
||||
t->executor.init_neighbours(all_executors);
|
||||
|
||||
// MDSource
|
||||
auto thread = find_thread_for_actor("MDSource", me->actor_threads);
|
||||
|
||||
Reference in new issue
Block a user