JDB
unread,Jul 8, 2011, 10:28:25 AM7/8/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to high-frequency-fix-support, dmitry.b...@gmail.com
> Hello, guys!
>
> Thank you so much for your work!
>
> I have a little question regarding your TCP Example. For me, it's
> seems like this example wont work in case, when i recieve a very long
> FIX message that is longer than IO buffer.
> Can you give me an insight what should I do in this case? Easiest
> solution could be not just moving partial message to the beginning of
> the buffer, but to have some other buffer (std::string maybe, is it
> fast enough?) to store icomptele message and then concatenating this
> buffer with incoming IO buffer and then initializing reader over
> theese two.
>
> What do you think about it? I'm going to use this parser for our HFT
> Arbitrage, so latency is very important for us.
Hi!
Yes, the TCP example, which has a 512 byte buffer, will only work if
all FIX messages are shorter than 512 bytes. In general, the receive
buffer must be longer than the longest possible FIX 4.2 message.
I find that the best solution in production systems is to make the
receive buffer very large. Try using a 64 Kb receive buffer.
char buffer[64 << 10];
Since a typical FIX message is a few hundred bytes and a typical
server has tens of Gbs, 64Kb should be much larger than your largest
possible FIX message, and much smaller than the available memory in
your server. There is no performance penalty for making a large buffer
and then only using a small part of the buffer.
The TCP example uses blocking receive calls in a loop, because it's
simpler. If you're doing asynchronous receives, make sure that your
receive buffer persists for the lifetime of your socket, so that
fragments of TCP packets are stored in between asynchronous receive
calls.
Regards,
James Brock