Skip to content

Speed up the scripts of gkctl#489

Merged
AltraMayor merged 3 commits intomasterfrom
lua_dump
Jun 4, 2021
Merged

Speed up the scripts of gkctl#489
AltraMayor merged 3 commits intomasterfrom
lua_dump

Conversation

@AltraMayor
Copy link
Owner

The scripts shipped with gkctl were very slow because they would copy the content of the accumulator string multiple times per record of the table being dumped. The new code only concatenates the strings at the very end by calling the efficient table.concat() of Lua. The original scripts would take a minute to dump a modest-sized routing table, while the new code accomplishes the same task in less than a second.

@AltraMayor AltraMayor added the Operational demand This issue would make Gatekeeper safer and/or cheaper to operate label Jun 4, 2021
@AltraMayor AltraMayor added this to the First deployment milestone Jun 4, 2021
The original dylib.print_fib_dump_entry() would concat strings
multiple times per FIB entry while accumulating the whole output
in a single string.  This algorithm takes a minute to dump
a modest-sized routing table.

This patch rewrites dylib.print_fib_dump_entry() to use
string buffers (i.e. table.concat()).  Dumping a large routing
table now takes less than a second.
@AltraMayor
Copy link
Owner Author

Tested in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Operational demand This issue would make Gatekeeper safer and/or cheaper to operate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant