Parser Cache

The Cisco command-line parser in the Cisco software performs the translation and execution (parsing) of command lines. The Parser Cache feature was developed to rapidly process large configuration files, thereby dramatically improving load time.

Finding Feature Information

Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn . An account on Cisco.com is not required.

Managing the Parser Cache

To control the Parser Cache feature, perform the tasks described in the following sections. All of these tasks are optional:

Control of the Parser Cache

The Cisco IOS command-line parser in the Cisco IOS software performs the translation and execution (parsing) of command lines. The Parser Cache feature was developed to rapidly process large configuration files, thereby dramatically improving load time.

The Parser Cache feature allows the rapid recognition and translation of configuration lines in a configuration file that differ slightly from previously used configuration lines (for example, pvc 0/100, pvc 0/101, and so on) by dynamically creating, caching, and reusing simplified parse graphs. This improvement is useful primarily for configuration files that repeat similar commands hundreds or thousands of times, such as cases in which thousands of virtual circuits must be configured for subinterfaces, or hundreds of access lists must be configured. Performance will improve the most for those files in which the same commands are used repeatedly but the numerical arguments change from command to command.

The Parser Cache is enabled by default on all platforms using Cisco IOS Release 12.1(5)T and later releases. However, users with Cisco devices that do not require large configuration files may want to disable the Parser Cache to free the resources used by this feature. (Memory used by this feature depends on the size of the configuration files parsed, but is generally less than 512 KB.)

There are several ways to control the parser cache (these are all optional):

  • Clearing the Parser Cache--To free resources or to reset the parser cache memory, you may wish to clear the parse entries and hit/miss statistics stored by the Parser Cache feature

  • Disabling the Parser Cache--The Parser Cache feature is enabled by default. To disable the Parser Cache feature, use the no parser cache command in global configuration mode. When the parser cache is disabled, the noparsercache command line is written to the running configuration file. If you wish to disable the parser cache to free system resources, you should clear the parser cache before issuing the noparsercache command. You will not be able to clear the parser cache after disabling it.

  • Reenabling the Parser Cache--To reenable the Parser Cache feature after disabling it, use the parsercache command in global configuration mode

  • Monitoring the Parser--Statistics about the last configuration file parsed are kept in the system memory, along with hit/miss statistics on the commands parsed by the Parser Cache feature. “Hits” and “misses” refer to the matches that the parser cache was able to make to similar commands used previously in the configuration session. Those commands that are matched (“hits”) be parsed more efficiently. The parser cache cannot improve the parse time for those commands it was unable to match (“misses”).

Clearing the Parser Cache

To clear the information stored by the Parser Cache feature, complete the task in this section:

SUMMARY STEPS

  1. enable
  2. clear parser cache

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

clear parser cache

Example:


Device# clear parser cache

Clears the parse cache entries and hit/miss statistics stored for the Parser Cache feature.

Disabling the Parser Cache

The Parser Cache feature is enabled by default. To disable the Parser Cache feature, complete the task in this section:

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. no parser cache

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:


Device# configure terminal

Enters global configuration mode.

Step 3

no parser cache

Example:


Device(config)# no parser cache

Disables the Parser Cache feature:

  • When the parser cache is disabled, the noparsercache command line is written to the running configuration file.

  • If you wish to disable the parser cache to free system resources, you should clear the parser cache before issuing the noparsercache command. You will not be able to clear the parser cache after disabling it.

Reenabling the Parser Cache

To reenable the Parser Cache feature after disabling it, complete the task in this section:

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. parser cache

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:


Device# configure terminal
Enters global configuration mode.

Step 3

parser cache

Example:


Device(config)# parser cache

Enables the Parser Cache feature.

Monitoring the Parser

Statistics about the last configuration file parsed are kept in the system memory, along with hit/miss statistics on the commands parsed by the Parser Cache feature. “Hits” and “misses” refer to the matches that the parser cache was able to make to similar commands used previously in the configuration session. Those commands that are matched (“hits”) be parsed more efficiently. The parser cache cannot improve the parse time for those commands it was unable to match (“misses”).

To display the parser statistics, use the following command in privileged EXEC mode:

SUMMARY STEPS

  1. Router# show parser statistics

DETAILED STEPS

Command or Action Purpose

Router# show parser statistics

Displays statistics about the last configuration file parsed and the status of the Parser Cache feature.

What to do next

The following example shows sample output from the show parser statistics command:


Router# show parser statistics
 
Last configuration file parsed:Number of Commands:1484, Time:1272 ms
Parser cache:disabled, 0 hits, 0 misses

Theshow parser statistics command displays two sets of data, as follows:

  • The number of commands in the configuration file that was last copied into the running configuration, and the time it took for the system to parse them (a configuration file can be loaded into the running configuration at system startup, or by issuing commands such as the copy source running-config EXEC command).

  • The status of the parser cache (enabled or disabled) and the number of command matches (hits or misses) since the system was started or since the parser cache was cleared.

In the example shown, the hit/miss statistics (0/0) do not match the number of commands in the last configuration file parsed (1484), which indicates that the last configuration file was loaded while the parser cache was disabled.