diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md
index f6effe705..fa3fac84a 100644
--- a/doc/user/content/release_notes/_index.md
+++ b/doc/user/content/release_notes/_index.md
@@ -4,6 +4,19 @@ weight = 3
sort_by = "weight"
insert_anchor_links = "right"
+++
+## 2.0.4
+### User Visible Changes
+ - Fixed performance regression in order manager
+
+### Internal changes
+ - Improved market data diagnostics for bad configurations
+ - Changed market data default buffer size
+
+## 2.0.3
+### Internal changes
+ - Improved backwards compatibility in UI settings
+
+
## 2.0.2
### User Visible Changes
- Middle click the ladder price column to show the orders for that price level
diff --git a/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs b/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs
index 939bef5a0..ce49d6e87 100644
--- a/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs
+++ b/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs
@@ -20,6 +20,27 @@ namespace bts.shell {
readonly IBus _bus;
readonly OrdersModel _orders_model;
readonly UserSettingsHub _settings_hub;
+ /// Fills 'sorting-criterion' settings were compromised a while back (mid-late 2018).
+ /// The issue was that, when a column was sorted, its 'sort member path' was assigned to the SortingCriteria.col_name,
+ /// rather than the enum/id string.
+ /// This dictionary serves as a reverse-lookup so the sort member path can be converted to the enum/id string.
+ static readonly IReadOnlyDictionary _sort_member_to_id =
+ new Dictionary {
+ { nameof(FillsVM.Row.account), Columns.Account },
+ { nameof(FillsVM.Row.exchange), Columns.Exchange },
+ { nameof(FillsVM.Row.fill_key), Columns.FillKey },
+ { nameof(FillsVM.Row.fill_kind), Columns.FillKind },
+ { nameof(FillsVM.Row.fill_time), Columns.FillTime },
+ { nameof(FillsVM.Row.order_key), Columns.OrderKey },
+ { nameof(FillsVM.Row.order_type), Columns.OrderType },
+ { nameof(FillsVM.Row.price), Columns.Price },
+ { nameof(FillsVM.Row.security), Columns.Security },
+ { nameof(FillsVM.Row.security_key), Columns.SecurityKey },
+ { nameof(FillsVM.Row.side), Columns.Side },
+ { nameof(FillsVM.Row.size), Columns.Size },
+ { nameof(FillsVM.Row.time_in_force), Columns.TimeInForce },
+ { nameof(FillsVM.Row.user), Columns.User }
+ };
public FillsWindowFactory(TradingShellModule module, IBus bus, UserSettingsHub settings_hub, OrdersModel orders_model)
: base(module, "Fills") {
@@ -38,6 +59,7 @@ namespace bts.shell {
_bus.post(SparkTags.ShowWindow, await load(state));
IShellWindow _create(StartupData state) {
+ GridSettingsHelper.normalize_sorting_criterion(state.sorting_criterion, _sort_member_to_id);
var settings_manager = new WindowSettingsManager(_settings_hub,
state.grid,
get: us => us.fills_grid,
diff --git a/src/client/spark/Modules/Trading/OrderBook/Settings/OrderBookSettings.cs b/src/client/spark/Modules/Trading/OrderBook/Settings/OrderBookSettings.cs
index a5df93524..b243c4d16 100644
--- a/src/client/spark/Modules/Trading/OrderBook/Settings/OrderBookSettings.cs
+++ b/src/client/spark/Modules/Trading/OrderBook/Settings/OrderBookSettings.cs
@@ -99,8 +99,11 @@ namespace bts.shell.orderbook {
public OrderBookGridSettings grid_settings_wrapper() {
if (use_defaults)
return null;
- if (orderbook_grid == null)
- orderbook_grid = new OrderBookGridSettings(grid.clone(), _predicate_animations);
+ if (orderbook_grid == null) {
+ if (grid == null)
+ grid = _default_general_grid;
+ orderbook_grid = new OrderBookGridSettings(grid.clone(), _predicate_animations);
+ }
return orderbook_grid;
}
#pragma warning restore CS0612 // Type or member is obsolete
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs
new file mode 100644
index 000000000..a5e8c4dec
--- /dev/null
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace mbts.ui.settings {
+ static class GridSettingsHelper {
+ public static TColKey? parse_col_id(string id) where TColKey : struct =>
+ Enum.TryParse(id, true, out TColKey key) ? key : (TColKey?)null;
+
+ public static string fmt_col_id(TColKey key) where TColKey : struct =>
+ key.ToString();
+
+ public static void normalize_sorting_criterion(IEnumerable sorting_criterion, IReadOnlyDictionary sort_member_to_id) where TColKey : struct =>
+ normalize_sorting_criterion(sorting_criterion, new Func[] {
+ parse_col_id,
+ col_name => sort_member_to_id.TryGetValue(col_name, out var k) ? k : (TColKey?)null
+ });
+
+ public static void normalize_sorting_criterion(IEnumerable sorting_criterion, IEnumerable> conversion_dels) where TColKey : struct {
+ foreach (var sc in sorting_criterion) {
+ sc.col_name = conversion_dels
+ .Select(del => del(sc.col_name))
+ .FirstOrDefault(k => k.HasValue)?.ToString() ?? sc.col_name;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/view/Controls/DIYGrid/Utils/DIYGridSortManager.cs b/src/client/spark/view/Controls/DIYGrid/Utils/DIYGridSortManager.cs
index 47c87c5e3..689679c22 100644
--- a/src/client/spark/view/Controls/DIYGrid/Utils/DIYGridSortManager.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Utils/DIYGridSortManager.cs
@@ -1,5 +1,8 @@
-using bts.utils;
+using bts;
+using bts.collections;
+using bts.utils;
using mbts.collections;
+using mbts.ui.settings;
using mbts.ui.utility;
using mbts.utils;
using System;
@@ -51,8 +54,17 @@ namespace mbts.ui.controls {
).to_comparer();
}
- public void load_from(IEnumerable sorting_criterion) =>
- _on_settings(sorting_criterion.Select(sc => (EnumHelper.parse(sc.col_name), sc.is_ascending ? ListSortDirection.Ascending : ListSortDirection.Descending)));
+ public void load_from(IEnumerable sorting_criterion) {
+ var sort_member_to_id = _map
+ .Where(kv => !string.IsNullOrEmpty(kv.Value.col.sort_member_path))
+ .Distinct()
+ .ToDictionary(kv => kv.Value.col.sort_member_path, kv => kv.Key);
+ GridSettingsHelper.normalize_sorting_criterion(sorting_criterion, sort_member_to_id);
+ _on_settings(sorting_criterion
+ .Select(sc => (GridSettingsHelper.parse_col_id(sc.col_name), sc.is_ascending ? ListSortDirection.Ascending : ListSortDirection.Descending))
+ .Where(t => t.Item1.HasValue)
+ .Select(t => (t.Item1.Value, t.Item2)));
+ }
public IEnumerable create() =>
_active_cols.AsCollection().Select(t => new SortingCriteria(t.col.id, t.direction == ListSortDirection.Ascending));
diff --git a/src/client/spark/view/Shell/Workspaces/SettingsManagerTool.cs b/src/client/spark/view/Shell/Workspaces/SettingsManagerTool.cs
index 5ea469b71..51f13e964 100644
--- a/src/client/spark/view/Shell/Workspaces/SettingsManagerTool.cs
+++ b/src/client/spark/view/Shell/Workspaces/SettingsManagerTool.cs
@@ -22,15 +22,18 @@ namespace bts.settings {
ConsoleEx.WriteLine("Workspace Descriptions", ConsoleColor.Cyan);
foreach(var w in workspaces) {
- var r = from ws in w.value.windows
- group ws by ws.owner into grouping
- select new { key = grouping.Key.Replace("bts.shell.", ""), window_count = grouping.Count() };
- string desc = string.Empty;
- foreach(var i in r) {
- desc += $"{Environment.NewLine}\t{i.window_count} - {i.key}";
+ // if a workspace doesn't have any windows, we don't care about it
+ if (w.value.windows != null) {
+ var r = from ws in w.value.windows
+ group ws by ws.owner into grouping
+ select new { key = grouping.Key.Replace("bts.shell.", ""), window_count = grouping.Count() };
+ string desc = string.Empty;
+ foreach (var i in r) {
+ desc += $"{Environment.NewLine}\t{i.window_count} - {i.key}";
+ }
+ ConsoleEx.Write($"{w.key}", ConsoleColor.Yellow);
+ ConsoleEx.WriteLine($" - {w.value.windows?.Count} windows - {w.value.named_windows?.Count} named windows - {desc}");
}
- ConsoleEx.Write($"{w.key}", ConsoleColor.Yellow);
- ConsoleEx.WriteLine($" - {w.value.windows?.Count} windows - {w.value.named_windows?.Count} named windows - {desc}");
}
ConsoleEx.WriteLine("");
diff --git a/src/lib/config/protos/ExchangeSimCfg.proto b/src/lib/config/protos/ExchangeSimCfg.proto
index b2d69068f..9271985fd 100644
--- a/src/lib/config/protos/ExchangeSimCfg.proto
+++ b/src/lib/config/protos/ExchangeSimCfg.proto
@@ -5,7 +5,7 @@ message ExchangeSim {
optional bool merge_with_md = 1 [default=true];
optional bool forward_implied = 2 [default = false];
oneof source {
- string replay_url = 11 [default = "http://mdreplay.bluetradesys.local/spark/futures.coconut"];
+ string replay_url = 11 [default = "http://10.96.18.45/spark/futures.coconut"];
string replay_file = 12 [default = "futures.coconut"];
bool local_relay = 13;
}
diff --git a/src/lib/config/protos/MarketData.proto b/src/lib/config/protos/MarketData.proto
index 250936649..0055809d5 100755
--- a/src/lib/config/protos/MarketData.proto
+++ b/src/lib/config/protos/MarketData.proto
@@ -98,7 +98,7 @@ message CMEOptions
// Defines amount of time Feed Engine keeps cycling before going to sleep when no useful activity can be done
optional uint32 spin_time = 4 [default = 1];
optional uint32 channels_per_thread = 5 [default = 3];
- optional uint32 udp_socket_buffer_size = 11 [default = 33554432]; //32mb
+ optional uint32 udp_socket_buffer_size = 11 [default = 268435456]; //256mb
}
message CMEChannel {
repeated string id = 2;
@@ -190,7 +190,8 @@ message RecordOptions {
// Replay options
//
message ReplayOptions {
- optional string url = 1 [default = "http://mdreplay.bluetradesys.local/spark/futures.coconut"];
+ // Tired of fighting with dns
+ optional string url = 1 [default = "http://10.96.18.45/spark/futures.coconut"];
// 2.0 = double speed, 0.5 = half speed
optional double speed = 11 [default = 1.0];
diff --git a/src/lib/orderman/actors/order_manager/OrderManager.cpp b/src/lib/orderman/actors/order_manager/OrderManager.cpp
index e393c90f4..feae6507d 100644
--- a/src/lib/orderman/actors/order_manager/OrderManager.cpp
+++ b/src/lib/orderman/actors/order_manager/OrderManager.cpp
@@ -358,7 +358,7 @@ OrderManager::free_buffers(std::string const &session_name) {
}
void OrderManager::init_order_services() {
- auto& log = me->services_data.log;
+ auto &log = me->services_data.log;
for (auto &s : me->services_data.sessions) {
auto gw_name = GatewayName(s->session);
@@ -410,13 +410,14 @@ void OrderManager::init_order_services() {
};
s->exe_report_subs =
std::make_unique>(
- *this, gw_name, on_exe_r,log);
+ *this, gw_name, on_exe_r, log);
s->cancel_reject_subs =
- std::make_unique>(*this,
- gw_name,log);
+ std::make_unique>(
+ *this, gw_name, log);
s->gateway_status_subs = std::make_unique<
- ContentSubscription>(*this, gw_name,log);
+ ContentSubscription>(*this, gw_name,
+ log);
// publishers for execution reports, gateway status and cancel
// reject evets
@@ -494,18 +495,18 @@ void OrderManager::init_order_services() {
me->services_data.cor_id = ev.trace;
};
me->services_data.md_subs =
- std::make_unique>(*this, on_md_sub,
- on_book_update,log);
+ std::make_unique>(
+ *this, on_md_sub, on_book_update, log);
me->services_data.ticker_subs =
- std::make_unique>(*this,
- on_ticker_sub,log);
+ std::make_unique>(
+ *this, on_ticker_sub, log);
me->services_data.settlement_subs =
std::make_unique>(
- *this, on_settlement_sub,log);
+ *this, on_settlement_sub, log);
me->services_data.time_subs =
- std::make_unique>(*this,log);
+ std::make_unique>(*this, log);
me->services_data.order_creation_subs =
- std::make_unique>(*this,log);
+ std::make_unique>(*this, log);
}
void OrderManager::after_event() {
@@ -514,7 +515,8 @@ void OrderManager::after_event() {
for (auto &osd : me->services_data.sessions) {
auto &fix_stream = osd->current_buffer->first_stream();
if (fix_stream.n_msgs()) {
- auto scoped_do_work = trace::log_scope(me->services_data.log, {}, "OrderManager::after_event");
+ auto scoped_do_work = trace::log_scope(me->services_data.log, {},
+ "OrderManager::after_event");
fix_stream.close();
osd->gw.send_fix(osd->current_buffer, osd->current_trace);
reload_fix_buffer(*osd);
@@ -536,8 +538,10 @@ void OrderManager::reload_fix_buffer(SessionServicesData &osd) {
}
}
-void OrderManager::on_poll(trace::PerfLog&log) {
- auto scoped_do_work = trace::log_scope(log, {}, "OrderManager::dispatch_incoming_fix_messages");
+void OrderManager::on_poll(trace::PerfLog &log) {
+ auto scoped_do_work =
+ trace::log_scope(log, {}, "OrderManager::dispatch_incoming_fix_messages",
+ utils::TimeStamp::Interval::from_microseconds(2));
for (auto &osd : me->services_data.sessions)
osd->gw.dispatch_incoming_fix_messages();
}
diff --git a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp
index e1880efc4..af427f286 100644
--- a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp
+++ b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp
@@ -316,7 +316,12 @@ unique_ptr MDP3Main::prepare_handler(const string& channel_id, M
try {
auto handler = unique_ptr(new onixs::Handler(settings));
- handler->bindFeedEngine(*_engines.at(options.feed_engine()));
+ auto iter = _engines.find(options.feed_engine());
+ if (iter == _engines.end()) {
+ LOG(md,Fatal, "Missing feed engine definition '{}' for channel id '{}'. Add a feed_engine entry with name:'{}' to the CMEOptions config key.", options.feed_engine(), channel_id, options.feed_engine());
+ bts_assert_msg(iter != _engines.end(), "Missing feed engine definition.");
+ }
+ handler->bindFeedEngine(*(iter->second));
if (recovery) {
handler->bindTcpRecovery(*recovery);
_recovery.push_back(std::move(recovery));
diff --git a/testing/manual/server_performance/spreader_requote.txt b/testing/manual/server_performance/spreader_requote.txt
new file mode 100644
index 000000000..3724f0fb1
--- /dev/null
+++ b/testing/manual/server_performance/spreader_requote.txt
@@ -0,0 +1,69 @@
+Test Author: Pedro
+If it breaks: Pedro
+
+Spreader Requote Performance test
+
+Note: This test is fairly cumbersome to setup, because performance is
+very sensitive to a number of factors including compilation switches,
+hardware used, thread allocation and load on the machine. Pedro has
+the best handle on how do all this and should probably be the one
+doing this test.
+
+
+1) Make sure you are testing a release server build
+
+2) Make sure you use real hardware, with hyper threading turned off
+and cstates disabled, for the server side
+
+3) Make sure you isolate the CPU on which you are running the
+server. This is best done on Linux by editing /etc/default/grub like
+this:
+
+# this isolates CPU's 0 to 5 for better performance testing
+GRUB_CMDLINE_LINUX="isolcpus=0-5"
+
+4) Now make sure your configuration is set for the lowest latency,
+including dedicating a thread to the order manager on the isolated
+cores:
+
+OrdermanCfg {
+ value {
+ executor {
+ thread_name: "oman_orders"
+ poll: true
+ hosted_actor: "MDSource"
+ hosted_actor: "OrderManager"
+ }
+ executor {
+ thread_name: "oman_slow"
+ poll: false
+ hosted_actor: "*"
+ }
+ }
+}
+
+Threads {
+ value {
+ thread_group {name_rx: "mdp3feed" core: 0}
+ thread_group {name_rx: "oman_orders" core: 1}
+ thread_group {name_rx: "jf_ar_sim" core: 2}
+ thread_group {name_rx: ".*" core:6 core:7 core:8 core:9 core:10 }
+ }
+}
+
+5) Now you are ready to start testing. Start a shell and create a new
+synthetic say with 2 CL futures. Use the near month (fast ticking)
+future as the non quoting leg, so that the other leg gets quoted
+often. Make sure to disable throtling in the synthetic definition
+dialog.
+
+6) Place an order for this synthetic, away from the market.
+
+7) Now run for say 3 minutes. Visit http://youserver:8000/perf_trace
+You should see a graph indicating the median requote times for the
+order you created in 5). Make sure you have at least 100 data points
+and data the median time is around 12us. If you get anything greater
+than 15us, the test has failed.
+
+
+