Commit 8c7ac32a authored by Mike Hibler's avatar Mike Hibler

Add vnode_id index to vinterfaces table.

Part I of "Lessons learned from a 100K node experiment". nfree would
run for hours trying to free 100K virtual nodes due to a slow query in
Node::ReleaseSharedBandwidth(). Now it takes 5 minutes.

There were other lessons as well, but they fall in the category of
"rearranging deck chairs" since we are going to have to massively overhaul
lots of infrastructure to support O(100000+) node experiments on a regular
parent 061b0df5
......@@ -4038,7 +4038,8 @@ CREATE TABLE `vinterfaces` (
`bandwidth` int(10) NOT NULL default '0',
PRIMARY KEY (`node_id`,`unit`),
KEY `bynode` (`node_id`,`iface`),
KEY `type` (`type`)
KEY `type` (`type`),
KEY `vnode_id` (`vnode_id`)
# Add an index to vinterfaces to help speed up nfree of virtual nodes.
# Otherwise ReleaseSharedBandwith() query examines every row of vinterfaces.
use strict;
use libdb;
sub DoUpdate($$$)
my ($dbhandle, $dbname, $version) = @_;
if (!DBKeyExists("vinterfaces", "vnode_id")) {
DBQueryFatal("ALTER TABLE vinterfaces "
"ADD KEY `vnode_id` (`vnode_id`)");
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment