Thomas Vachuska

Adding ability to balance load between different cell servers.

Adding ability to specify structure/size of the cell.

Change-Id: I2b721dac187cc1a73be2949bdb71709ad72cbb48
...@@ -216,7 +216,7 @@ class Warden { ...@@ -216,7 +216,7 @@ class Warden {
216 new ServerInfo(info.hostName) : v.bumpLoad(info))); 216 new ServerInfo(info.hostName) : v.bumpLoad(info)));
217 217
218 List<ServerInfo> servers = new ArrayList<>(load.values()); 218 List<ServerInfo> servers = new ArrayList<>(load.values());
219 - servers.sort((a, b) -> a.load - b.load); 219 + servers.sort((a, b) -> b.load - a.load);
220 ServerInfo server = servers.get(0); 220 ServerInfo server = servers.get(0);
221 return server.cells.get(random.nextInt(server.cells.size())).cellName; 221 return server.cells.get(random.nextInt(server.cells.size())).cellName;
222 } 222 }
......
...@@ -85,7 +85,7 @@ public class WardenTest { ...@@ -85,7 +85,7 @@ public class WardenTest {
85 validateCellState(doltCell); 85 validateCellState(doltCell);
86 validateSizes(4, 2); 86 validateSizes(4, 2);
87 87
88 - assertTrue("cells should not be on the same host", 88 + assertFalse("cells should not be on the same host",
89 Objects.equals(warden.getCellHost(dudeCell.cellName), 89 Objects.equals(warden.getCellHost(dudeCell.cellName),
90 warden.getCellHost(doltCell.cellName))); 90 warden.getCellHost(doltCell.cellName)));
91 91
......