Question

I'm using the hornetq-core-client api 2.4.0.Final, adding message with this code:

            ClientMessage clientMessage = _producerClientSession.createMessage(true);
            clientMessage.putStringProperty(MESSAGE_KEY, message);
            _clientProducer.send(clientMessage);

I'm reusing ClientSession and ClientProducer as mentioned in the docs. During profiling, we see this taking an average of 400+ ms. Does this seem right? It seems slow. We also have installed AIO on and running on ubuntu.

EDIT: Here is the output for "iostat -d -x 1" while enqueueing was taking 600ms on avg

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00  596.00     0.00  2568.00     8.62     1.20    2.01    0.00    2.01   0.04   2.40

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00    44.00    0.00  611.00     0.00 12904.00    42.24     0.10    0.17    0.00    0.17   0.05   2.80

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00  642.00     0.00  2916.00     9.08     0.02    0.03    0.00    0.03   0.03   2.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00  648.00     0.00  2900.00     8.95     0.03    0.04    0.00    0.04   0.04   2.80

EDIT #2 We updated our config to include:

    Configuration configuration = new ConfigurationImpl();
    configuration.setPersistenceEnabled(true);
    configuration.setJournalSyncTransactional(false);

And for creating ClientSessionFactory to:

ClientSessionFactory sf = null;
  try {
    hornetQServer.start();
    ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName()));
    serverLocator.setBlockOnDurableSend(false);
    serverLocator.setProducerWindowSize(100000);

    serverLocator.setBlockOnAcknowledge(false);
    ClientSessionFactory sf = serverLocator.createSessionFactory();

The send time is now less than one millisecond. Are any of these settings unsafe, or not recommended for typical situations?

Was it helpful?

Solution

When you have a single producer, a persistent message has to be persisted on the disk, and synced to your disk.

the client will block until all of that is happening.

The server is programmed to manage multiple producers and use most of your hardware, but if you only have one producer your performance will be maxed out by your network latency + your disk sync speed.

So for a single producer, sending a persistent message non transactionally (every send is a sync) it does sound right.

Edit: Also look at the set/getJournalBufferTimeout_AIO and set/getJournalBufferTimeout_NIO at ConfigurationImpl. Those are the values that are sent to the TimedBuffer before the server syncs data on disk waiting for other clients to sync at the same time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top