Skip to content

Make Initiator`s inbound channel buffered (#22) - #732

Closed
AlexandrosKyriakakis wants to merge 3 commits into
quickfixgo:mainfrom
alpacahq:develop
Closed

AlexandrosKyriakakis wants to merge 3 commits into
quickfixgo:mainfrom
alpacahq:develop

Conversation

@AlexandrosKyriakakis

Copy link
Copy Markdown
Contributor

We have observed slow consumption of FIX messages in the Initiator.

Since the outbound channel is buffered, the event loop is sending too many messages at once but reads incoming messages one by one. This creates an inconsistency between incoming consumption messages and outgoing production messages.

In this PR we resolve this issue by making the inbound channel buffered. So the Initiator can now read and write in a truly asynchronous way.

This change is feature flagged. Can be used by setting InitiatorInChanCapacity with an integer representing the capacity of the inbound channel to the session settings config.

We have observed slow consumption of FIX messages in the Initiator.

Since the outbound channel is buffered, the event loop is sending too
many messages at once but reads incoming messages one by one. This
creates an inconsistency between incoming consumption messages and
outgoing production messages.

In this PR we resolve this issue by making the inbound channel buffered.
So the Initiator can now read and write in a truly asynchronous way.

This change is feature flagged. Can be used by setting
`InitiatorInChanCapacity` with an integer representing the capacity of
the inbound channel to the session settings config.
Comment thread initiator.go
// note: Here we don't use "github.com/alpacahq/quickfix/config" to set the config "InitiatorInChanCapacity"
// because we currently use "github.com/quickfixgo/quickfix/config" for the configs so it will break the dependencies
// either way, the config can be passed through the SessionSettings map
const initiatorInChanCapacityConfig = "InitiatorInChanCapacity"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be added to the acceptor as well? I think this is overall a good change, although I'd prefer this particular config in config/configuration.go and match comment style in there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, should this be added to the acceptor, config should likely be named InChanCapacity instead

@michaelwilner

Copy link
Copy Markdown
Contributor

Hey @AlexandrosKyriakakis I cherry-picked your commit, resolved merge conflicts, and extended it to the acceptor side as well. Also validated against our internal system’s test suite. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants