[Java Real-Time SDK] Performance issue while request instruments of a chain component
Hello,
I would like your advice about performance issue while request instruments of a chain component.
For example, the chain 0#SRD.PA contains 144 instruments.
My algorythm opens one chain for SRD.PA (to retrieve its elements), and request each intruments to retrieve its quote informations :
protected RefinitivItem callChain(String ricId) {
FlatChain fChain = new FlatChain.Builder()
.withOmmConsumer(consumer.getConsumer())
.withChainName(ricId)
.withSynchronousMode()
.withUpdates(false)
.build();
fChain.open();
RefinitivItem item = new RefinitivItem(ricId, fChain);
for (Entry<Long, String> element : fChain.getElements().entrySet()) {
if (!element.getValue().isEmpty()) {
addFields(item, element);
}
}
fChain.close();
return item;
}
private void addFields(RefinitivItem item, Entry<Long, String> element) {
String elementRic = element.getValue();
RefinitivFields fields = callByRic(elementRic);
if (fields != null) {
item.addFields(element.getValue(), fields);
}
}
protected RefinitivFields callByRic(String ricId) {
RefinitivFields fields = null;
MarketPrice.Builder b = new MarketPrice.Builder().withOmmConsumer(consumer.getConsumer())
.withName(ricId)
.withUpdates(false)
.withSynchronousMode();
b.withField("REF_COUNT");
b.withField("RDNDISPLAY");
b.withField("RECORDTYPE");
b.withField("PREF_DISP");
b.withField("LOW_1");
b.withField("HIGH_1");
MarketPrice marketPrice = b.build();
marketPrice.open();
if (OmmState.DataState.OK == marketPrice.getState().dataState()
|| OmmState.DataState.NO_CHANGE == marketPrice.getState().dataState()) {
fields = new RefinitivFields(ricId, new ArrayList<>(marketPrice.getFields()));
}
marketPrice.close();
return fields;
}
Since openinig the request for one instrument lasts approximately 200 milliseconds, the call for the whole chain instruments lasts more than 30 seconds.
So my question is: am I doing it right ?
Best Answer
-
The Value add objects is for simplified access to the content - it is not geared towards performance. I would recommend that you initiate a batch request from the instruments in that chain.
0
Answers
-
Hi @BMI,
30 seconds is a very long time - are you connecting to a remote endpoint? Typically, for a local RTDS, your batch request should be fulfilled in few 100 milliseconds. I would recommend that you try the same request with an EMA batch example and compare.
You can modify the batch example which is packaged with the SDK - https://github.com/Refinitiv/Real-Time-SDK/tree/master/Java/Ema/Examples/src/main/java/com/refinitiv/ema/examples/training/consumer/series300/ex370_MP_Batch
0 -
Hi @Gurpreet,
Thank you for your answer.
I am connecting to a remote endpoint, with Delivery Direct.
Here is a piece of my EmaConfig.xml file :
Channel
<ChannelGroup>
<ChannelList>
<Channel>
<Name value="Channel_1"/>
<ChannelType value="ChannelType::RSSL_ENCRYPTED"/>
<CompressionType value="CompressionType::None"/>
<GuaranteedOutputBuffers value="5000"/>
<ConnectionPingTimeout value="30000"/>
<EncryptedProtocolType value="EncryptedProtocolType::RSSL_SOCKET"/>
<Host value="eu-west-1-aws-3-lrg.optimized-pricing-api.refinitiv.biz"/>
<Port value="14002"/>
<EnableSessionManagement value="1"/>
<WsProtocols value="tr_json2"/>
</Channel>
</ChannelList>
</ChannelGroup>Dictionary
<DictionaryGroup>
<DictionaryList>
<Dictionary>
<Name value="Dictionary_1"/>
<DictionaryType value="DictionaryType::ChannelDictionary"/>
</Dictionary>
</DictionaryList>
</DictionaryGroup>I tried the batch example, and performances are much better.
But in my case, I have to display all the instruments' quotations from the chain, so I request EMA synchronously.
For that, I use the ValueAddObjectsForEMA example library.
I noticed that when calling the MarketPrice.open method, a Thread.sleep(200) is performed in the library.
At first, I tried to reduce this waiting time. It's faster, but the instruments are still requested synchronously.
Maybe I should try to request all the instruments asynchronously, and wait for all quotation informations to be retrieved, then compute the result for the presentation layer ?
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 33 Data Model Discovery
- 682 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.8K Refinitiv Data Platform
- 622 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 84 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛