Thursday, February 21, 2013

Show run/copy run start on Cisco takes forever?

Are you frustrated that "Show run", "Show run interface <something>, "write mem" or "copy run start" is taking forever on Cisco routers or switches? Rest assure that you are not alone, there are many of us who feel your pain. It even takes longer to return these results on a system containing numerous lines in the running configuration. Why? Because the NVGEN process needs to query everything about your router and then output these results. It's painstakingly long especially when you are in the middle of troubleshooting something. 30 seconds may as well be 30 years. Not to mention that it almost results in a CPU spike sending false alerts everywhere and to everyone. To return the results of the aforementioned commands much faster enable the configuration performance enhancement by typing "parser config cache interface" in the global config mode.

 R1#config t
 R1(config)#parser ?
  cache  Configure parser cache
  config Configure config generation
  view  View Commands
 R1(config)#parser config ?
  cache   Cache the configuration
  interface Enable caching interface configs
 R1(config)#parser config cache ?
  interface Enable caching interface configs
 R1(config)#parser config cache interface ?
 R1(config)#parser config cache interface

Now you're commands should be zipping by without a CPU spike. Keep in mind that this command will consume as much memory as your running-configuration. So for example, let's say that you're running-config is 20K then it will take 20K of your free memory. But 20K is minuscule compared to the performance boost you will notice.  20K is a small price to pay especially when you have 100s of Megabytes left in free memory. And if you are really worried about whether you have 20K of free memory to spare for this command then you have bigger issues to worry about like memory leaks. Also anytime you make a change to the config the cache is flushed and the cache is reloaded with the updated running config

Many more articles to come so stay tuned.

Please subscribe/comment/+1 if you like my posts as it keeps me motivated to write more and spread the knowledge.

No comments:

Post a Comment