The parser command

The Cisco IOS parser has a variety of functions. It helps you to create roles for IOS role-based security (see Cisco IOS role-based access), and it helps cache configurations when IOS configuration files are transferred to or from memory. The parser that is used for parsing configurations is enabled by default. However, the “extended” version of the parser is not. This newer option for using the parser system actually speeds up the viewing of the IOS running configuration.

Have you ever performed a show running-configuration (or show run) command and waited “too many” seconds for it to appear? Frustrating, right? You can use a new version of the parser command to speed up that view time. As the parser system is a caching system, it is going to do two things: (1) keep the IOS configuration in memory and use more of your memory to do it and (2) be more effective as repetition increases and as the configuration gets larger.

How the parser config cache interface command can help

When you issue a show running-config command, it queries every interface on your router and then compiles all this information into a total configuration. Think about how many times you issue this command. This process, known as nonvolatile generation (NVGEN), polls and retrieves every component and interface and every command.

Based on the size of your router and its interfaces, that show run can take quite a while and possibly slow down your router’s performance. The Configuration Generation Performance Enhancement feature cuts this process time down from minutes virtually to seconds because it retrieves only the changes that were made to the configuration file. There are a few things that you will need to be aware of though.

First, you need to be aware that extra memory will be used to do this. Second, you will need to issue the show running-config command and will only see the benefits of the parser cache the second time you issue the command.

Also, each time the configuration is changed, the interface file that you have stored in memory is flushed so you will need to process another show running-config command to cache the most current file.

How do you use the parser config cache interface command?

So, let’s go through the process to see how easy it is to configure this feature.

Router# configure terminal
Router(config)# parser config cache interface
Router(config)# exit

Keep in mind that this command will cache the router’s configuration in RAM, using some amount of RAM to allow you to take advantage of this caching feature.

What’s the effect of using the parser config cache?

The effect of using the parser config cache command is an approximate 50-percent savings in the time required to bring up the Cisco IOS configuration (the second time and thereafter). In my case, I used a small 800-series router with a clock running next to the console. Without the parser config, I counted five seconds to display the small IOS configuration file. I enabled the parser config cache command and did a show run again. This time I saw a 50-percent decrease in wait time because the configuration came up in about two seconds. On a router with a huge configuration file, this 50-percent savings could be 30 seconds or more. If you added all the time saved from having to wait for the configuration, the total time saved could be huge.

What are some other parser-related commands?

The general parser cache feature is enabled by default. You can view the statistics for it using the show parser statistics command, like this:

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

The parser view and superview commands are used in role-based authentication configuration.

And finally, parser macros are IOS macros used to speed up repetitive configurations. You can view the parser macros with the show parser macro command.

One of the features that can benefit us immediately is to turn on the Configuration Generation Performance Enhancement feature. In other words, we can use the parser config cache interface command in global configuration mode. By enabling this simple feature, the show run output will show up much quicker (the second time you run it). For more information, see the Cisco documentation covering the parser cache and the Configuration Generation Performance Enhancement.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!