Networking

Learn how the Cisco IOS parser command can speed up response time

On routers with large running configurations, the parser cache is used to speed up the "parsing" of that IOS configuration when the configuration is accessed and processed by the router. David Davis explains what the parser cache does and how it can help you.

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. Conclusion

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!

7 comments
Photogenic Memory
Photogenic Memory

That's pretty clever. I do need some advice though. I purchased a router from Ebay to practice with. I can configure the unit with no problems. And I can save the config by issuing a "copy run start". However when I actually reload the router to restart it; the configuration is gone. It's like it was never touched? But, I can do "show start" and it there saved in memory? I then can manually apply the saved file by doing "copy start run". I'm confused. Is it a physical memory problem or an extra setting? Any response would be helpful.

amanr
amanr

I would also check the boot value. Some routers require this some don't. sh boot or sh bootvar You can also set the boot config file/location via :- config> boot system flash start-config Issue a wr me or copy run start after this.

option12
option12

the other guys are probably right---your boot register is set for password recovery mode, where it will ignore the startup file. change the value as suggested to turn off.

mikemcarthur
mikemcarthur

The router is not booting from the startup-config because the config-register setting is wrong. Try these commands: conf t config-register 0x2102 end reload

david.haczynski
david.haczynski

This is actually changed in rommon. Interrupt the boot cycle by press cntl break you will get an rommon > prompt. Follow these instructtions. To change the virtual configuration register from the ROM monitor manually, enter the command confreg followed by the new value of the register in hexadecimal, as shown in the following example: rommon 1 > confreg 0x2101 You must reset or power cycle for new config to take effect rommon 2 >

Editor's Picks