Commit fe0fa1d4 authored by Simon Pastor's avatar Simon Pastor
Browse files

bw sharing

parent c7bb6e87
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@ module github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-tc-engine
go 1.12

require (
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-bw-sharing v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-ctrl-engine-model v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mg-manager-model v0.0.0
	github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db // indirect
	github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351
	github.com/go-redis/redis v6.15.2+incompatible
	github.com/gogo/protobuf v1.2.1 // indirect
@@ -19,8 +19,6 @@ require (
	github.com/json-iterator/go v1.1.6 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.1 // indirect
	github.com/onsi/ginkgo v1.8.0 // indirect
	github.com/onsi/gomega v1.5.0 // indirect
	github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
	github.com/spf13/pflag v1.0.3 // indirect
	golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a // indirect
@@ -36,7 +34,9 @@ require (
)

replace (
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-bw-sharing => ../../go-packages/meep-bw-sharing
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-ctrl-engine-model => ../../go-packages/meep-ctrl-engine-model
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger => ../../go-packages/meep-logger
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mg-manager-model => ../../go-packages/meep-mg-manager-model
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis => ../../go-packages/meep-redis
)
+4 −0
Original line number Diff line number Diff line
@@ -40,8 +40,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -64,6 +66,7 @@ golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts=
@@ -83,6 +86,7 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+269 −182

File changed.

Preview size limit exceeded, changes collapsed.

+51 −29
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019  InterDigital Communications, Inc
 * Copyright (c) 2019
 * InterDigital Communications, Inc.
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * The information provided herein is the proprietary and confidential
 * information of InterDigital Communications, Inc.
 */

package main

import (
@@ -25,6 +17,7 @@ import (
	"time"

	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
	redis "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis"
)

type history struct {
@@ -59,6 +52,8 @@ type stat struct {
	stddev  time.Duration
}

const moduleMetrics string = "metrics"

func (u *destination) ping(pinger *Pinger) {
	rtt, err := pinger.Ping(u.remote, opts.timeout)
	if err != nil {
@@ -79,7 +74,7 @@ func (u *destination) addResult(rtt time.Duration, err error) {
	s.mtx.Unlock()
}

func (u *destination) compute() (st stat) {
func (u *destination) compute(rc *redis.Connector) (st stat) {
	s := u.history
	s.mtx.RLock()
	defer s.mtx.RUnlock()
@@ -147,7 +142,9 @@ func (u *destination) compute() (st stat) {
	return
}

func (u *destination) processRxTx() {
var elasticPacing int

func (u *destination) processRxTx(rc *redis.Connector) {

	str := "tc -s qdisc show dev ifb" + u.ifbNumber
	out, err := cmdExec(str)
@@ -190,12 +187,15 @@ func (u *destination) processRxTx() {
	previousRcvedBytes := u.historyRx.rcvedBytes

	var throughput float64
	var diffInMs int
	if previousRcvedBytes != 0 {

		previousTime := u.historyRx.time

		diff := currentTime.Sub(previousTime)
		throughput = 8 * (float64(rcvedBytes) - float64(previousRcvedBytes)) / diff.Seconds()
		diffInSeconds := diff.Seconds()
		diffInMs = int(diffInSeconds * 1000)
		throughput = 8 * (float64(rcvedBytes) - float64(previousRcvedBytes)) / diffInSeconds
	}

	var throughputStr, throughputVal string
@@ -220,6 +220,28 @@ func (u *destination) processRxTx() {
	u.historyRx.time = currentTime
	u.historyRx.rcvedBytes = rcvedBytes

	var stats = make(map[string]interface{})
	stats["uniqueName"] = PodName
	stats["trafficFrom"] = u.remoteName
	stats["totalReceivedPkts"] = rcvedPkts
	stats["totalDroppedPkts"] = droppedPkts
	stats["droppedPktRate"] = pktDroppedRateStr
	stats["totalReceivedBytes"] = rcvedBytes
	stats["receivedBytesDuringInterval"] = rcvedBytes - previousRcvedBytes
	stats["intervalInMs"] = diffInMs
	stats["throughput"] = throughputVal

	var throughputStats = make(map[string]interface{})
	throughputStats[u.remoteName] = throughputVal

	//store as an individual dataset but also as an aggregate for throughput only (for now)
	_ = rc.SetEntry(moduleMetrics+":"+PodName+":"+u.remoteName, stats)
	//throughput stats will be appended if the entry didn't exist or replaced if it does
	_ = rc.SetEntry(moduleMetrics+":"+PodName+":throughput", throughputStats)

	//pacing the logs in ES
	elasticPacing++
	if elasticPacing%10 == 0 {
		log.WithFields(log.Fields{
			"meep.log.component":     "sidecar",
			"meep.log.msgType":       "ingressPacketStats",
@@ -232,5 +254,5 @@ func (u *destination) processRxTx() {
			"meep.log.throughputStr": throughputStr,
			"meep.log.packet-loss":   pktDroppedRateStr,
		}).Info("Measurements log")

	}
}
+3 −2
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ go 1.12

require (
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis v0.0.0
	github.com/coreos/go-iptables v0.4.0
	github.com/go-redis/redis v6.15.2+incompatible
	github.com/gogo/protobuf v1.2.1 // indirect
@@ -11,8 +12,6 @@ require (
	github.com/json-iterator/go v1.1.6 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.1 // indirect
	github.com/onsi/ginkgo v1.8.0 // indirect
	github.com/onsi/gomega v1.5.0 // indirect
	github.com/spf13/pflag v1.0.3 // indirect
	golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
	gopkg.in/inf.v0 v0.9.1 // indirect
@@ -24,4 +23,6 @@ require (
	sigs.k8s.io/yaml v1.1.0 // indirect
)

replace github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis => ../../go-packages/meep-redis

replace github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger => ../../go-packages/meep-logger
Loading