• Programming Guide
  • Api Documentation
  • OnixS CME iLink3 Handler for .NET Core, version 1.4.2
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Getting Started
    • Error Reporting
    • Licensing
    • SBE Message
      • Tag-based Messaging
      • Message Fields
      • Repeating Groups
    • iLink 3 Session
      • Universally Unique Identifier
      • Establishing iLink3 Connection
      • Exchanging Messages
      • Message Sequence Numbers
  • Configuring the Handler
    • Configuration File Examples (XML or JSON)
  • Logging
  • Session Storage
    • File-Based Session Storage
    • Memory-based Session Storage
    • Asynchronous File-Based Session Storage
    • Pluggable Session Storage
  • Advanced Programming
    • Thread Safety
    • Session Initialization and Binding
    • Session States
    • Listening to Session Events
    • Handling NotApplied Messages
    • Handling Business Reject Messages
    • Automated Downloading of GTC and GTD Orders
    • Reconnection
    • Fault Tolerance
    • Understanding Send Latency
    • Strongly Typed Messages
  • Best Practices
    • Low Latency Best Practices
  • Glossary
  • Support

File-Based Session Storage

File-Based Session Storage keeps incoming and outgoing messages and session's state data in files in the StorageDirectory folder.

For each iLink 3 session, the following files are created:

  • SESSION_NAME.state contains session state data (Uuid, Negotiated, InSeqNum, OutSeqNum, PreviousSeqNo, PreviousUuid, etc.).
  • SESSION_NAME.summary contains Base64 encoded binary SBE messages.

SESSION_NAME is formed on the base of Uuid, Firm, MarketSegmentId, and a timestamp. It is available via the StorageId property.

Segmented File-Based Storage

Sometimes it is needed to save space on disk, and there is no need to keep the whole history of incoming and outgoing messages. File-Based Storage could be configured to store messages in a set of .summary files, instead of a single one. The entire collection of logged messages is split through several files called "segments", and older segments could be archived.

The Segmented mode of the File-based Storage is activated when the FileBasedStorageSegmentSize is set to a positive value.

Segments are named as StorageID[-part-N].summary, where:

  • StorageID- the generic ID of storage (available via the StorageId property);
  • -part-N- the segment suffix. The N is the 1-based number of segments. One segment does not have this suffix - it is the segment where the newest messages are stored.

During the session lifetime, new segment files are created per the following algorithm:

  • A new message is saved to the StorageID.summary file;
  • When the message is saved, the StorageID.summary file size is compared to the FileBasedStorageSegmentSize value, and if the actual file size exceeds this value, a new segment is created;
  • To create a new segment, the Handler renames StorageID.summary to StorageID-part-N.summary and creates a new empty StorageID.summary file to store subsequent messages. The N is a sequential number of parts starting from 1.

So during a long session, a set of files could be created: StorageID.summary, StorageID-part-1.summary, StorageID-part-2.summary, etc. . Oldest messages are stored in the StorageID-part-1.summary file, and newer ones - in the StorageID.summary and StorageID-part-N.summary files, where N is the maximum value.

The number of segments is recorded in the StorageID.state file after the FilePartCount key. For instance, if there are 5 segments, (StorageID.summary, StorageID-part-1.summary, ... , StorageID-part-4.summary) the following line will be stored in the StorageID.state file:

FilePartCount=5

Examples

File-Based Storage without segmentation

SessionSettings settings = new SessionSettings();

using (Session session = new Session(settings, marketSegmentId, SessionStorageType.FileBasedStorage))
{
}

Segmented storage


SessionSettings settings = new SessionSettings();

settings.FileBasedStorageSegmentSize = 256 * 1024;

using (Session session = new Session(settings, marketSegmentId, SessionStorageType.FileBasedStorage))
{
}
In This Article
Back to top Copyright © Onix Solutions.
Generated by DocFX