6.17. Setting Guaranteed Delivery for Commands

Many commands, like pings between the agent and server, are not critical to JBoss ON functions. These are volatile commands. Volatile commands are sent once; if they fail, the failure is logged, the agent drops the command, and the next command is processed.
Critical commands, however, must be sent to the JBoss ON server and successfully processed. The agent must guarantee that these commands are delivered. These are guaranteed commands. The agent guarantees, as far as possible, that these commands reach the server (although outside events, such as a JVM crashing, can keep the commands from being sent). Guaranteed commands persist in a command spool file even if the agent shuts down, so that the next time the agent starts, it can be loaded and queued to be delivered to the server.
There are four parameters that are related to guaranteed delivery:
  • A time interval that sets how frequently the agent should try to resend a failed command (rhq.agent.client.retry-interval-msecs)
  • A filename for the spool file (rhq.agent.client.command-spool-file.name)
  • A setting that configures the spool file (rhq.agent.client.command-spool-file.params). This settings has the format max_file_size:purge_percentage. The file size is defined in bytes; once the file hits that file size, then a purge operation trims the file down to whatever the percentage is. So, if the file is set to be 100 KB (100000) and the purge percentage is 90, then the file is trimmed back to 90 KB after a purge operation. The purge operation first tries to compress unused space, and then begins purging commands, starting with the oldest.
  • An optional setting that allows the spool file to be compressed (rhq.agent.client.command-spool-file.compressed). Compressing the spool file can reduce its size 30-40%, but in some corner cases, it can adversely affect agent performance (such as when the agent shuts down before all of the guaranteed commands have been sent).
Guaranteed delivery is configured by default, allowing both the agent to resend critical commands and to compress spool file.
rhq.agent.client.command-spool-file.compressed=true
rhq.agent.client.command-spool-file.name=command-spool.dat
rhq.agent.client.command-spool-file.params=10000000:75
rhq.agent.client.retry-interval-msecs=15000
To change any of the guaranteed delivery settings:
  1. Open the agent prompt. For example, if the agent process is already running, the prompt can be opened by re-running the rhq-agent.sh script with the -n option.
    agentRoot/rhq-agent/bin/rhq-agent.sh -n
  2. Send the setconfig with the new guaranteed delivery settings.
    > setconfig rhq.agent.client.command-spool-file.compressed=true
    rhq.agent.client.command-spool-file.name=my-spool.dat
    rhq.agent.client.command-spool-file.params=25000000:67
    rhq.agent.client.retry-interval-msecs=25000
  3. Restart the agent process to load the new configuration.
    agentRoot/rhq-agent/bin/rhq-agent-wrapper.sh stop
    
    agentRoot/rhq-agent/bin/rhq-agent.sh