peter-lawrey / TransFIX

Faster FIX engine.
http://chronicle.software/products/transfix/
GNU Lesser General Public License v3.0
87 stars 49 forks source link

How to run the performance test? #21

Open paulwbill opened 9 years ago

paulwbill commented 9 years ago

Hi there!

I would like to run the latency tests on our environment. In the website you say that you can parse a FixMessage in 30 nanoseconds. What message is that? And when you say you can transmit a message in 1.5 micros, what library are you using to write the message to the network?

I checked the sources but could not find the performance test class. Any details you can give us about the performance test will be appreciated.

thompsri commented 9 years ago

I think the test in question is TestTransFix.java (testAvgParseTime), however there's some more work to do around this test as it clears the message after the first of the 50m iterations hence the 30ns result is not quite right. I'd expect the result to be more like 300ns for a parser which frames the message into CharSequences "views" without copying the underlying data and about 1us for a parser which copies the field values

ashelleyhft commented 9 years ago

fmr.setFixBytes(fixMessagesArray[i]); is where it resets the data for each iteration. Not sure where you are seeing the empty ones. Pls. let me know.

On Thu, May 14, 2015 at 4:52 PM, Richard Thompson notifications@github.com wrote:

I think the test in question is TestTransFix.java (testAvgParseTime), however there's some more work to do around this test as it clears the message after the first of the 50m iterations hence the 30ns result is not quite right. I'd expect the result to be more like 300ns for a parser which frames the message into CharSequences "views" without copying the underlying data and about 1us for a parser which copies the field values

— Reply to this email directly or view it on GitHub https://github.com/OpenHFT/TransFIX/issues/21#issuecomment-102165885.

thompsri commented 9 years ago

Looking at the test "net.openhft.fix.include.v42.examples.TestTransFix#testAvgParseTime"

       for (int i = 0; i < runs; i++) {
            fmr.setFixMessage(fm);
            fmr.setFixBytes(byteBufBytes);  <= clears the message on 2nd iteration
            fmr.parseFixMsgBytes();
            counter++;
        }

The second time this loop executes, the code in setFixBytes clears the input message so the remaining iterations just parse an empty message.

  public void setFixBytes( ByteBufferBytes fixMsgBufBytes ) {
        if ( this.fixMsgBytes != null ) {
            this.fixMsgBytes.clear();
        }
        this.fixMsgBytes = fixMsgBufBytes.flip();
    }
martinstuga commented 8 years ago

Probably it would be nice to implement this benchmark with this project: http://openjdk.java.net/projects/code-tools/jmh/

It really does exhaustive benchmarks as it avoids to run your code in loops to avoid JIT optimisation and and also does an JVM warm-up before run the test it self.

If you see this as a nice stuff to have, just let me know, because I'm available to develop it.

danielshaya commented 8 years ago

Hello Paulo

TransFix is longer being actively maintained. It has been replaced with Chronicle-FIX which is our enterprise FIX engine.

In this project we are making extensive use of jmh and can optimize fix parsing/generation so that we can achieve latencies comfortably sub micro-second.

Regards Daniel

On Sun, Dec 27, 2015 at 12:34 AM, Paulo Martins notifications@github.com wrote:

Probably it would be nice to implement this benchmark with this project: http://openjdk.java.net/projects/code-tools/jmh/

It really does exhaustive benchmarks as it avoids to run your code in loops to avoid JIT optimisation and and also does an JVM warm-up before run the test it self.

If you see this as a nice stuff to have, I'm available to develop it. So, please let me know.

— Reply to this email directly or view it on GitHub https://github.com/OpenHFT/TransFIX/issues/21#issuecomment-167373229.

martinstuga commented 8 years ago

Thank you for your response @danielshaya. Jmh is definitely and I thought it fits well on this project. Happy to see that you're already using it.

All the best,

Paulo.