mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-19 11:21:13 +02:00
Enhancing intent-perf logging
Fixing defect in distributed app mgmt Reducing DB manager heartbeat aggressiveness Change-Id: I9ba948a2b2166625c56566502143c0d27f9a2c44
This commit is contained in:
parent
ab8553a52a
commit
0249b5377d
@ -55,9 +55,12 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
import static java.lang.String.format;
|
||||||
import static org.apache.felix.scr.annotations.ReferenceCardinality.MANDATORY_UNARY;
|
import static org.apache.felix.scr.annotations.ReferenceCardinality.MANDATORY_UNARY;
|
||||||
import static org.onlab.util.Tools.delay;
|
import static org.onlab.util.Tools.delay;
|
||||||
import static org.onlab.util.Tools.groupedThreads;
|
import static org.onlab.util.Tools.groupedThreads;
|
||||||
|
import static org.onosproject.net.intent.IntentEvent.Type.INSTALLED;
|
||||||
|
import static org.onosproject.net.intent.IntentEvent.Type.WITHDRAWN;
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,23 +122,24 @@ public class IntentPerfInstaller {
|
|||||||
// we will need to discard the first few results for priming and warmup
|
// we will need to discard the first few results for priming and warmup
|
||||||
listener = new Listener();
|
listener = new Listener();
|
||||||
intentService.addListener(listener);
|
intentService.addListener(listener);
|
||||||
|
|
||||||
|
long delay = System.currentTimeMillis() % REPORT_PERIOD;
|
||||||
reportTimer = new Timer("onos-intent-perf-reporter");
|
reportTimer = new Timer("onos-intent-perf-reporter");
|
||||||
reportTimer.scheduleAtFixedRate(new TimerTask() {
|
reportTimer.scheduleAtFixedRate(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
listener.report();
|
listener.report();
|
||||||
}
|
}
|
||||||
}, REPORT_PERIOD, REPORT_PERIOD);
|
}, delay, REPORT_PERIOD);
|
||||||
|
|
||||||
stopped = false;
|
stopped = false;
|
||||||
worker.submit(() -> {
|
worker.submit(() -> {
|
||||||
delay(2000);
|
delay(2000); // take a breath to start
|
||||||
createIntents(NUM_KEYS, 2); //FIXME
|
createIntents(NUM_KEYS, 2); //FIXME
|
||||||
prime();
|
prime();
|
||||||
while (!stopped) {
|
while (!stopped) {
|
||||||
cycle();
|
cycle();
|
||||||
// TODO delay if required
|
delay(800); // take a breath
|
||||||
delay(600);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -186,7 +190,6 @@ public class IntentPerfInstaller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createIntents(int numberOfKeys, int pathLength) {
|
private void createIntents(int numberOfKeys, int pathLength) {
|
||||||
|
|
||||||
Iterator<Device> deviceItr = deviceService.getAvailableDevices().iterator();
|
Iterator<Device> deviceItr = deviceService.getAvailableDevices().iterator();
|
||||||
|
|
||||||
Device ingressDevice = null;
|
Device ingressDevice = null;
|
||||||
@ -238,12 +241,11 @@ public class IntentPerfInstaller {
|
|||||||
|
|
||||||
class Listener implements IntentListener {
|
class Listener implements IntentListener {
|
||||||
|
|
||||||
|
private final Map<IntentEvent.Type, Counter> counters;
|
||||||
private Map<IntentEvent.Type, Counter> counters;
|
private final Counter runningTotal = new Counter();
|
||||||
|
|
||||||
public Listener() {
|
public Listener() {
|
||||||
counters = initCounters();
|
counters = initCounters();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<IntentEvent.Type, Counter> initCounters() {
|
private Map<IntentEvent.Type, Counter> initCounters() {
|
||||||
@ -263,18 +265,21 @@ public class IntentPerfInstaller {
|
|||||||
|
|
||||||
public void report() {
|
public void report() {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
double total = counters.get(IntentEvent.Type.INSTALLED).throughput() +
|
Counter installed = counters.get(INSTALLED);
|
||||||
counters.get(IntentEvent.Type.WITHDRAWN).throughput();
|
Counter withdrawn = counters.get(WITHDRAWN);
|
||||||
|
double current = installed.throughput() + withdrawn.throughput();
|
||||||
|
runningTotal.add(installed.total() + withdrawn.total());
|
||||||
for (IntentEvent.Type type : IntentEvent.Type.values()) {
|
for (IntentEvent.Type type : IntentEvent.Type.values()) {
|
||||||
stringBuilder.append(printCounter(type)).append("; ");
|
stringBuilder.append(printCounter(type)).append("; ");
|
||||||
}
|
}
|
||||||
stringBuilder.append(String.format("TOTAL=%.2f", total));
|
log.info("Throughput: OVERALL={}; CURRENT={}; {}",
|
||||||
log.info("Intent Throughput:\n{}", stringBuilder);
|
format("%.2f", runningTotal.throughput()),
|
||||||
|
format("%.2f", current), stringBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String printCounter(IntentEvent.Type event) {
|
private String printCounter(IntentEvent.Type event) {
|
||||||
Counter counter = counters.get(event);
|
Counter counter = counters.get(event);
|
||||||
String result = String.format("%s=%.2f", event, counter.throughput());
|
String result = format("%s=%.2f", event, counter.throughput());
|
||||||
counter.reset();
|
counter.reset();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ public class ApplicationArchive
|
|||||||
* archive stream or store
|
* archive stream or store
|
||||||
* the application archive
|
* the application archive
|
||||||
*/
|
*/
|
||||||
public ApplicationDescription saveApplication(InputStream stream) {
|
public synchronized ApplicationDescription saveApplication(InputStream stream) {
|
||||||
try (InputStream ais = stream) {
|
try (InputStream ais = stream) {
|
||||||
byte[] cache = toByteArray(ais);
|
byte[] cache = toByteArray(ais);
|
||||||
InputStream bis = new ByteArrayInputStream(cache);
|
InputStream bis = new ByteArrayInputStream(cache);
|
||||||
@ -190,7 +190,7 @@ public class ApplicationArchive
|
|||||||
*
|
*
|
||||||
* @param appName application name
|
* @param appName application name
|
||||||
*/
|
*/
|
||||||
public void purgeApplication(String appName) {
|
public synchronized void purgeApplication(String appName) {
|
||||||
File appDir = new File(appsDir, appName);
|
File appDir = new File(appsDir, appName);
|
||||||
try {
|
try {
|
||||||
Tools.removeDirectory(appDir);
|
Tools.removeDirectory(appDir);
|
||||||
@ -209,7 +209,7 @@ public class ApplicationArchive
|
|||||||
* @param appName application name
|
* @param appName application name
|
||||||
* @return application archive stream
|
* @return application archive stream
|
||||||
*/
|
*/
|
||||||
public InputStream getApplicationInputStream(String appName) {
|
public synchronized InputStream getApplicationInputStream(String appName) {
|
||||||
try {
|
try {
|
||||||
File appFile = appFile(appName, appName + ".zip");
|
File appFile = appFile(appName, appName + ".zip");
|
||||||
return new FileInputStream(appFile.exists() ? appFile : appFile(appName, APP_XML));
|
return new FileInputStream(appFile.exists() ? appFile : appFile(appName, APP_XML));
|
||||||
|
@ -104,8 +104,8 @@ public class DatabaseManager implements StorageService {
|
|||||||
.withReceiveBufferSize(32768)
|
.withReceiveBufferSize(32768)
|
||||||
.withSendBufferSize(8192)
|
.withSendBufferSize(8192)
|
||||||
.withThreads(1))
|
.withThreads(1))
|
||||||
.withElectionTimeout(300)
|
.withElectionTimeout(3000)
|
||||||
.withHeartbeatInterval(150)
|
.withHeartbeatInterval(1500)
|
||||||
.withMembers(activeNodeUris)
|
.withMembers(activeNodeUris)
|
||||||
.withLocalMember(localNodeUri);
|
.withLocalMember(localNodeUri);
|
||||||
|
|
||||||
@ -114,8 +114,8 @@ public class DatabaseManager implements StorageService {
|
|||||||
partitionMap.forEach((name, nodes) -> {
|
partitionMap.forEach((name, nodes) -> {
|
||||||
Set<String> replicas = nodes.stream().map(this::nodeToUri).collect(Collectors.toSet());
|
Set<String> replicas = nodes.stream().map(this::nodeToUri).collect(Collectors.toSet());
|
||||||
DatabaseConfig partitionConfig = new DatabaseConfig()
|
DatabaseConfig partitionConfig = new DatabaseConfig()
|
||||||
.withElectionTimeout(300)
|
.withElectionTimeout(3000)
|
||||||
.withHeartbeatInterval(150)
|
.withHeartbeatInterval(1500)
|
||||||
.withConsistency(Consistency.STRONG)
|
.withConsistency(Consistency.STRONG)
|
||||||
.withLog(new FileLog()
|
.withLog(new FileLog()
|
||||||
.withDirectory(logDir)
|
.withDirectory(logDir)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}
|
#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}
|
||||||
export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx2048m}"
|
export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx2g}"
|
||||||
|
|
||||||
ONOS_HOME=/opt/onos
|
ONOS_HOME=/opt/onos
|
||||||
|
|
||||||
|
17
tools/test/bin/onos-intentperf-scrape
Executable file
17
tools/test/bin/onos-intentperf-scrape
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Scrapes intent performance numbers from the remote ONOS log file.
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
|
||||||
|
. $ONOS_ROOT/tools/build/envDefaults
|
||||||
|
|
||||||
|
nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
|
||||||
|
|
||||||
|
for node in $nodes; do
|
||||||
|
echo "fetching from ${node}..."
|
||||||
|
ssh $ONOS_USER@${node} "
|
||||||
|
grep 'Throughput: OVERALL=' $ONOS_INSTALL_DIR/log/karaf.log \
|
||||||
|
| sed 's/ | INFO .*\: OVERALL=/|/;s/\; INSTALL_REQ=.*//;s/\; CURRENT=/|/' | cut -c12-
|
||||||
|
" > ${node}.perf.log
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user