Create Maintenance Plan

Create Maintenance Plan

To keep AMPS running smoothly, 60East recommends developing a maintenance plan, and creating an action configuration to implement the maintenance plan.

AMPS actions provide a way for the server to perform specific tasks in response to specific events. The most common use for actions is to create a maintenance schedule, as described below.

Details on AMPS actions are provided in the Automating AMPS with Actions section of the AMPS User Guide. Configuration for Actions are described in the Actions section of the AMPS Configuration Guide.

The following table describes maintenance for various features of AMPS. If your installation of AMPS doesn't use a given feature, there is no need to have a maintenance plan for that feature.

Feature

Maintenance Required

Actions

Statistics Database

Truncate unneeded statistics.

60East recommends retaining statistics for the period of time that you will need to have available for troubleshooting problems.

For example, if your monitoring policies evaluate throughput twice a week, truncating statistics the day after each evaluation may be reasonable.

amps-action-do-truncate-statistics

Transaction Log

Remove unneeded journal files.

60East recommends removing journal files when the messages contained within the file are no longer needed.

amps-action-do-remove-journal

Event and Error Logs

Remove unneeded log files.

60East recommends retaining log files for the period of time that you will need to have available for troubleshooting problems.

amps-action-do-remove-files

60East recommends that you consider the following maintenance actions, and whether they are appropriate for your installation:

Feature

Optional Maintenance

Actions

Transaction Log

Archiving journals to higher-capacity storage.

Journal files moved to the archive directory are still part of the transaction log and are available for replay, replication, queue message delivery, and so on.

60East recommends moving journals to higher capacity storage in the event that high-speed storage does not have enough space to hold the journals required to meet the needs of the application for access to older messages.

amps-action-do-archive-journal

Transaction Log

Compressing journals to save space.

Compressed journal files are still part of the transaction log and are available for replay, replication, queue message deliver, and so on.

60East recommends compressing journals in cases where storage space is restricted, or where storage performance for older journals is low, such that spending the extra CPU time to uncompress a journal will provide higher performance than retrieving an uncompressed journal.

The amount of space saved by compression depends on the data contained in each journal file.

amps-action-do-compress-journal

State of the World (SOW)

Removing unnecessary records.

60East recommends deleting records from the SOW when they are no longer needed. Many times, this happens as a part of the workflow for the application. In cases where the workflow does not inherently remove unneeded data, consider using an action to maintain the topic.

amps-action-do-delete-sow

Example Maintenance Plan

For example, the following maintenance plan runs each day, at 23:00 (11 PM local time).

The plan performs the following maintenance:

  • Archives journal files older than three days

  • Removes journal files older than 14 days

  • Truncates statistics to keep the last 7 days of statistics

  • Removes log files in the $AMPS_ADMIN/logs directory that are older than 7 days, and

  • Removes any records in the Orders topic in the SOW that have a status of canceled that have not been updated in the last two days.

    There are a few important points to notice in the filter used to remove records from the Orders topic:

    • Since the timestamps have a unit of seconds, the Filter describes 48 hours as 172800 seconds (60 seconds in a minute * 60 minutes in an hour * 48 hours).

    • Since the configuration file is in XML format, the Filter uses the XML escape for the < symbol (&lt;). This is translated into a < symbol when the configuration file is parsed.

    • Within an action, AMPS replaces the token {{AMPS_UNIX_TIMESTAMP}} with the point in time that the action begins running. We can use this to create a Filter that uses the correct value no matter when the filter is run.

<Actions>
   <Action>
     <On>
       <Module>amps-action-on-schedule</Module>
       <Options>
         <Name>Nightly maintenance</Name>
         <Every>23:00</Every>
       </Options>
    </On>

    <!-- Archive journals older than three days -->
    <Do>
      <Module>amps-action-do-archive-journal</Module>
      <Options>
         <Age>3d</Age>
      </Options>
    </Do>

    <!-- Remove journals older than 14 days -->
    <Do>
      <Module>amps-action-do-remove-journal</Module>
      <Options>
        <Age>14d</Age>
      </Options>
    </Do>

    <!-- Remove statistics older than 7 days -->
    <Do>
      <Module>amps-action-do-truncate-statistics</Module>
      <Options>
        <Age>7d</Age>
      </Options>
    </Do>

    <!-- Remove event logs that are older than
         seven days. -->

    <Do>
       <Module>amps-action-do-delete-files</Module>
       <Options>
           <Pattern>${AMPS_ADMIN}/logs/*.log</Pattern>
           <Age>7d</Age>
       </Options>
    </Do>

    <!-- Remove records from the Orders topic in the SOW
         that are canceled and have not been updated
         in two days -->
    <Do>
       <Module>amps-action-do-delete-sow</Module>
       <Options>
           <Topic>Orders</Topic>
           <MessageType>json</MessageType>
           <Filter>/status = 'canceled'
                   AND LAST_UPDATED() &lt; ({{AMPS_UNIX_TIMESTAMP}} - 172800) </Filter>
       </Options>
    </Do>
   </Action>
</Actions>

Last updated

Copyright 2013-2024 60East Technologies, Inc.