How reduce delay between sending messages using Ema C++ Consumer
Hello everyone, can you please tell me exist possibility decrease delay between sended messages using Ema C++ interface.
I using default approach with next code. And it's in the cycle without any delay from my side.
consumer->submit(PostMsg()
.streamId(_postStreamID)
.postId(postID).domainType(MMT_MARKET_PRICE)
.solicitAck(true).complete()
.payload(UpdateMsg()
.streamId(_postStreamID)
.name(RIC)
.payload(fieldList))
.complete(),
_subStreamHandle);
I expected performance as 1~10ms between sended messages and get next result.
<!-- Time: 7:00:01:887 -->
<key flags="0x2 (RSSL_MKF_HAS_NAME)" name="GBPSZB10YD=RAIS"/>
<!-- Time: 7:00:01:965 -->
<key flags="0x2 (RSSL_MKF_HAS_NAME)" name="AUDSZB4YD=RAIS"/>
It's spended in average 80~120ms, i found it's very large delay. And I try to find any solution how I can decrease this delay. I used simple configuration for my Ema interface.
Any information from your side about this will be heplfull. Thanks in advance.
Best Answer
-
I assume that you are contributing data to Refinitiv Contributions Channel and you get the timestamp from the XML trace in EMA.
I modified the code to send messages in a for loop to verify the timestamps in the XML trace.
for (int i = 0; i <= 4; i++) {
_pOmmConsumer->submit(PostMsg()
.streamId(_postStreamID)
.postId(_postID).domainType(MMT_MARKET_PRICE)
.solicitAck(true).complete()
.payload(UpdateMsg().streamId(_postStreamID)
.name("TRCCTEST01")
.payload(FieldList()
.addReal(22, _BID, OmmReal::ExponentNeg2Enum)
.addReal(25, _ASK, OmmReal::ExponentNeg2Enum)
.complete()))
.complete(),
_subStreamHandle);
_postID++;
_BID++;
_ASK++;
}If I enable XmlTraceToStdout, the delay is around 10-50 ms.
<XmlTraceToStdout value="1"/>
<XmlTraceToFile value="0"/><!-- Time: 11:08:57:414 -->
<!-- Time: 11:08:57:461 -->
<!-- Time: 11:08:57:504 -->
<!-- Time: 11:08:57:521 -->
<!-- Time: 11:08:57:568 -->However, If I enable XmlTraceToFile, there is no delay in millisecond in the XML trace file.
<XmlTraceToStdout value="0"/>
<XmlTraceToFile value="1"/><!-- Time: 11:21:04:513 -->
<!-- Time: 11:21:04:513 -->
<!-- Time: 11:21:04:513 -->
<!-- Time: 11:21:04:513 -->
<!-- Time: 11:21:04:513 -->In conclusion, enabling XML tracing will impact the performance of the application, especially XmlTraceToStdout. In the production environment, you should disable tracing and use the release build.
0
Answers
-
How I some investigate my point i keep wait answer ACK responce for continue sending next message, i remove this logic. And try to send messages immidiatly when it possible.Could you please look my configuration, maybe another parameters loose my performance in production case.Current my result with not wait ACK equal 15ms, it's good but not enough.
0 -
@mikhail.maryankou
You may need to log timestamps when the application called the submit method to post messages. It may be a delay in the application.
0 -
Also, please be aware that you are not required to wait for an ACK before sending the next message. If you send too many Posts and exceed any RCC Queue limits, then you will receive a NACK.
0 -
I solved my problem. For the first i don't wait ACK responce for increase performance. For the second as delay bad case using Sleep() function, because this method do not guarantee that's 1ms sleeping it's 1ms awaking. In my case it's spend 15~20ms. Exist two ways for using in this case. It's WaitForSingleObject or more modern with condition variable:
std::mutex mtx;
std::unique_lock lk(mtx);
std::condition_variable cv;
while (fSvcStopPauseFlag != 1)
{
cv.wait_for(lk, std::chrono::milliseconds(1)); // guarantee delay 1ms
// send you message
}I hope that's my explanation can help anybody in future.
Thank you all for your participation in this thread.0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛