OpenAMQ provides a wide set of tuning options. Before you start tuning your server, please note that:
These are the options that affect the server process:
These are the options that affect network configuration and performance:
Note: We recommend that rather than tuning the tcp_rcvbuf and tcp_sndbuf options at the application level, you should rely on the default values of "0" and tune your operating system's TCP stack appropriately. For a good guide to TCP Tuning, see here.
You can tune the number of messages that queues will accept. This is useful to ensure that your server does not run out of virtual memory when you have fast publishers and slow clients, and a very high rate of data.
OpenAMQ provides a mechanism called "queue profiles" to let you control the limits on a per-queue basis. By default (in amq_server_base.cfg), we define two queue profiles as follows:
<queue_profile name = "private">
<limit name = "warn" value = "10000" />
<limit name = "trim" value = "50000" />
</queue_profile>
<queue_profile name = "shared">
<limit name = "warn" value = "10000" />
<limit name = "kill" value = "50000" />
</queue_profile>
These profiles define the behaviour of private and shared queues respectively. In each profile we can define up to 10 limits, which specify a number of messages, and an action to perform when that limit is reached:
To override these limits, edit amq_server.cfg (not the base config file) e.g.:
amq_server.cfg:
<?xml version="1.0"?>
<config>
<queue_profile name = "shared">
<limit name = "warn" value = "500" />
<limit name = "drop" value = "1000" />
</queue_profile>
<queue_profile name = "private">
<limit name = "warn" value = "500" />
<limit name = "trim" value = "1000" />
</queue_profile>
</config>
OpenAMQ also lets you define per-queue profiles. When your application creates a queue, using the Queue.Declare method (the amq_queue_declare() method in the WireAPI interface), it can specify a profile name, as follows:
This only happens when the queue is created; if the Queue.Declare is specified for an existing queue, it's profile is not modified. If no profile is specified in the Queue.Declare method, OpenAMQ uses 'private' for exclusive queues and 'shared for non-exclusive queues.
The WireAPI layers are not configurable via the command line, so you will want to create an XML configuration file to tune this layer.
The file must be called wireapi.cfg and must be located on the PATH, or in the current directory where the applications are run.
Use the same format for this file as for the server configuration file, e.g.
<?xml?>
<config>
<tuning
tcp_rcvbuf = "128000"
tcb_sndbuf = "128000"
heartbeat = "5"
/>
</config>
The standard test tool for performance is amq_client. This sends a number of messages to a private temporary queue, and reads the messages back off that queue.
Start the server with monitoring enabled (so that it displays the traffic rate):
amq_server --monitor 1
Start multiple instances of amq_client on one or a series of test systems:
amq_client -s server:port -n 20000 -x 500 -r 0
This is an example of the monitor output produced by the server:
I: incoming rate=2545 mean=2392 peak=4115 I: outgoing rate=2545 mean=2392 peak=4114 iomean=4784
When you tune the server performance, it is the iomean that you should be aiming to improve.