Skip to content

Data Delays

ttldtor edited this page Mar 16, 2021 · 3 revisions

Delays for all types of events and for all symbols? If not, then most likely it is not the API issue. Possibly a problem with the network or services. You can also connect an "onHeartbeat" handler for heartbeats from the server and look at server_lag_mark and connection_rtt, as in the sample:
https://github.com/dxFeed/dxfeed-c-api/blob/f99e84cf7c267a68d5bc8fe57534596f13d6e650/samples/CommandLineSample/CommandLineSample.c#L647
https://github.com/dxFeed/dxfeed-c-api/blob/f99e84cf7c267a68d5bc8fe57534596f13d6e650/samples/CommandLineSample/CommandLineSample.c#L511-L515

void on_server_heartbeat_notifier(dxf_connection_t connection, dxf_long_t server_millis, dxf_int_t server_lag_mark,
								  dxf_int_t connection_rtt, void* user_data) {
	fwprintf(stderr, L"\n##### Server time (UTC) = %" PRId64 " ms, Server lag = %d us, RTT = %d us #####\n",
			 server_millis, server_lag_mark, connection_rtt);
}
//...
dxf_set_on_server_heartbeat_notifier(connection, on_server_heartbeat_notifier, NULL);

A large server_lag_mark may indicate that the service spends a lot of time serializing and sending data. connection_rtt shows how long, on average, data travels from your computer to the server.

If delays for all instruments and all types of events, then you should make sure that there is no heavy computation in the handlers of incoming events. This can affect reading data from the socket.

If the network (usually, the load on the network the most) allows, then there will be no special lags even if millions are requested.