Caching of OMMStreamCache objects using a lot of memory
We have a use case where we allow users to scan market data for instruments that meet certain criteria. These scans can request historical data snapshots across 1000-2000 instruments or more. Memory profiling shows that after performing a scan of almost 2000 instruments the OMMConnection object was using 158MB of memory (see attached screenshot from dotMemory).
Is there a way to not cache OMMStreamCache objects if it is a snapshot request, or could the amount of data held in memory be reduced? Here is our code when making a historical snapshot request...
public IObservable<WorkspaceSnapShotStreamingResponse> GetTimeSeriesDataSnapShot(
ISession workspaceSession,
WorkspaceSnapShotStreamingRequest request,
WorkspaceMetadataResponse metadataResponse)
{
return Observable.Create<WorkspaceSnapShotStreamingResponse>(observer =>
{
SerialDisposable activeSubscriptionToken = new SerialDisposable();
if (workspaceSession.OpenState == Session.State.Opened)
{
// Build the request
var summariesDefinition = BuildRequest(request);
// Make the request
activeSubscriptionToken.Disposable = summariesDefinition
.GetDataAsync(workspaceSession)
.ToObservable()
.Subscribe(OnSubscribeAction, observer.OnError);
// Deal with the response
void OnSubscribeAction(IDataSetResponse workspaceResponse)
{
if (workspaceResponse.Data != null)
{
if (workspaceResponse.Data.Table != null)
{
observer.OnNext(ConvertDataTableToWorkspacePriceRecords(
workspaceResponse.Data.Table,
request.Interval,
request.View,
TimeSeriesUpdateType.Update));
observer.OnCompleted();
}
else
{
Logger.Warn(workspaceResponse.Data.Errors);
observer.OnNext(new WorkspaceSnapShotStreamingResponse());
}
}
}
}
return activeSubscriptionToken;
});
}
private ISummariesDefinition BuildRequest(WorkspaceSnapShotStreamingRequest request)
{
var summariesDefinition = Summaries
.Definition(request.Symbol)
.Interval(ResponseHelper.ConvertInterval(request.Interval, Logger))
.Fields(request.View.MapTo.ToArray());
if (request.Count > 0)
{
summariesDefinition.Count(request.Count);
}
else if (request.RequestRange.StartDateTime.HasValue)
{
summariesDefinition.Start((DateTime)request.RequestRange.StartDateTime);
}
else if (request.RequestRange.EndDateTime.HasValue)
{
summariesDefinition.End((DateTime)request.RequestRange.EndDateTime);
}
return summariesDefinition;
}
Best Answer
-
If by snapshot you mean a historical pricing snapshot using .GetData(), then my suspicions is that there may be other requests going out within your application the uses .GetStream(), via historical or Pricing. For example, if I were to write a small, standalone example that only uses .GetData() for the historical summaries interface, there would be no streaming connection nor any requests for streaming data in this scenario. If you are seeing the opposite, can you put together a small test example our team can try to replicate? Or, maybe you can try one of the github examples to confirm.
thanks.
0
Answers
-
The OMMStreamCache is a container managing open stream IDs and references as opposed to holding a cache of the data objects. If you are asking for snapshots, the OMMStreamCache will clean up the references once a refresh or status has been sent. In theory, the OMMStreamCache should be clean after fulfilling a request. There may be something else dangling within this container.
I can bring it to the attention of the development team to observe.
thanks.
0 -
If you want to perform a streaming snapshot, then you should make a call something like this:
var snap = Pricing.Definition("CAD=").Fields("BID", "ASK", "DSPLY_NAME")
.GetStream().Streaming(false);When you specify .Streaming(false) this will automatically clean up the cache with the details I mentioned above. The default is: .Streaming(true) and this will keep the streams open for every item requested.
Now, if you're mixing this with historical streaming bars, by definition, the historical streaming bars keep the stream open. I don't fully understand what you are trying to retrieve given that a historical snapshot using .getData() already gives you the latest values within the bars. But if your requirement is to retrieve latest realtime values, then you can perform the snapshot based on the code segment I provided above.
0 -
0
-
0
-
@cory.schmidt.1Hi
How are you retrieving historical data? Are you using .GetStream() and opening? Or are you simply using .GetData()? If you're using .GetData(), there is no attempt to open any stream.
0 -
We're calling .GetDataAsync() to retrieve history. That's what prompted this question... it seemed odd to have an IOMMItemStream object created and held in memory for each instrument when we are requesting a snapshot not a stream.
0 -
0
-
@nick.zincone You were correct about having requests that were creating subscriptions. We had a section of code checking QoS for each requested instrument creating a stream. Once we added Streaming(false) to get a snapshot instead then the memory consumption was greatly reduced. Thanks for the feedback.0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 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
- 252 ETA
- 557 WebSocket API
- 38 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.9K Refinitiv Data Platform
- 653 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛