Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bin/*
!bin/*.json
.idea/*
/protocols/topsmr
.DS_Store
1 change: 1 addition & 0 deletions bench/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (b *Benchmark) Run() {
}

b.startTime = time.Now()
log.Infof("Benchmark Start\n")
if b.T > 0 {
timer := time.NewTimer(time.Second * time.Duration(b.T))
loop:
Expand Down
33 changes: 17 additions & 16 deletions bin/config.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
{
"address": {
"1.1": "tcp://127.0.0.1:1735",
"1.2": "tcp://127.0.0.1:1736",
"1.3": "tcp://127.0.0.1:1737",
"1.4": "tcp://127.0.0.1:1738",
"1.5": "tcp://127.0.0.1:1739"
"1.1": "tcp://18.191.133.55:1735",
"1.2": "tcp://3.15.184.126:1736",
"1.3": "tcp://3.142.184.9:1737",
"1.4": "tcp://3.143.108.225:1738",
"1.5": "tcp://3.17.190.39:1739"
},
"http_address": {
"1.1": "http://18.191.133.55:8080",
"1.2": "http://3.15.184.126:8081",
"1.3": "http://3.142.184.9:8082",
"1.4": "http://3.143.108.225:8083",
"1.5": "http://3.17.190.39:8084"
},
"ephemeral_leader": true,
"policy": "majority",
"threshold": 3,
"thrifty": false,
"chan_buffer_size": 1024,
"buffer_size": 1024,
"multiversion": false,
"num_relays": 2,
"regions_peer_groups": false,
"fixed_relays": false,
"relay_slack": 0,
"std_pig_timeout": 50,
"use_small_p2b": true,
"use_retro_log": false,
"benchmark": {
"T": 10,
"T": 60,
"N": 0,
"K": 1,
"K": 1000,
"W": 0.5,
"Throttle": 0,
"Concurrency": 15,
"Concurrency": 90,
"Distribution": "conflict",
"LinearizabilityCheck": false,
"Conflicts": 0,
Expand All @@ -42,4 +43,4 @@
"MaxOutstanding": 10,
"OpenLoopThrottle": 0
}
}
}
45 changes: 45 additions & 0 deletions bin/pigConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"address": {
"1.1": "tcp://3.15.230.27:1735",
"1.2": "tcp://13.58.224.139:1736",
"1.3": "tcp://18.188.74.117:1737",
"1.4": "tcp://3.135.20.76:1738",
"1.5": "tcp://18.222.33.228:1739"
},
"ephemeral_leader": true,
"policy": "majority",
"threshold": 3,
"thrifty": false,
"chan_buffer_size": 1024,
"buffer_size": 1024,
"multiversion": false,
"num_relays": 1,
"regions_peer_groups": false,
"fixed_relays": false,
"relay_slack": 0,
"std_pig_timeout": 50,
"use_small_p2b": true,
"benchmark": {
"T": 60,
"N": 0,
"K": 1,
"W": 0.5,
"Throttle": 0,
"Concurrency": 10,
"Distribution": "conflict",
"LinearizabilityCheck": false,
"Conflicts": 0,
"Min": 0,
"Mu": 500,
"Sigma": 50,
"Move": false,
"Speed": 10,
"Zipfian_s": 2,
"Zipfian_v": 1,
"Lambda": 0.01,
"Size": 8,
"OpenLoopWorker": false,
"MaxOutstanding": 10,
"OpenLoopThrottle": 0
}
}
2 changes: 1 addition & 1 deletion log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func Debug(v ...interface{}) {

func Debugf(format string, v ...interface{}) {
if log.severity == DEBUG {
log.debug.Output(2, fmt.Sprintf(format, v...))
//log.debug.Output(2, fmt.Sprintf(format, v...))
}
}

Expand Down
2 changes: 2 additions & 0 deletions main/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/acharapko/pbench"
"github.com/acharapko/pbench/bench"
"github.com/acharapko/pbench/idservice"
"runtime/debug"
)

var id = flag.String("id", "", "node id this client connects to")
Expand All @@ -14,6 +15,7 @@ var load = flag.Bool("load", false, "Load K keys into DB")

func main() {
pbench.Init()
debug.SetGCPercent(-1)
preferredId := idservice.ID(0)
if *id != "" {
preferredId = idservice.NewIDFromString(*id)
Expand Down
54 changes: 51 additions & 3 deletions main/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import (
"github.com/acharapko/pbench/protocols/batchedpaxos"
"github.com/acharapko/pbench/protocols/epaxos"
"github.com/acharapko/pbench/protocols/paxos"
"io/ioutil"
"os"
"runtime/debug"
"sync"
"strconv"
"strings"
"time"
"github.com/acharapko/pbench/protocols/pigpaxos"
"net/http"
"sync"

l "log"
_ "net/http/pprof"
)
Expand Down Expand Up @@ -47,9 +52,51 @@ func replica(id idservice.ID) {
}
}

func getCpuSample() (idle uint64, total uint64) {
contents, err := ioutil.ReadFile("/proc/stat")
if err != nil {
log.Errorf("node %v proc stat read %v ", id, err)
return
}
lines := strings.Split(string(contents), "\n")
//cpu user nice system idle io irq softirq
for _, line := range(lines) {
fields := strings.Fields(line)
if fields[0] == "cpu" {
for i := 1; i < len(fields); i++ {
time, err := strconv.ParseUint(fields[i], 10, 64)
if err != nil {
log.Errorf("node %v Atoi error %s ", id, line)
}
total += time
if i == 4 {
idle = time
}
}
return
}
}
return
}

func cpuUtilization(id idservice.ID) {
idlePrev, totalPrev := getCpuSample()
for{
time.Sleep(1 * time.Second)
idleCurr, totalCurr := getCpuSample()
idleTime := float64(idleCurr - idlePrev)
totalTime := float64(totalCurr - totalPrev)
cpuUtilization := 100 * (totalTime - idleTime)/totalTime
idlePrev, totalPrev = idleCurr, totalCurr
log.Infof("node %v CPU utilization: %f ", id, cpuUtilization)
}
}


func main() {
pbench.Init()

log.Infof("Config: %s",os.Args[len(os.Args)-1])
debug.SetGCPercent(-1)
if *simulation {
var wg sync.WaitGroup
wg.Add(1)
Expand All @@ -60,6 +107,7 @@ func main() {
}
wg.Wait()
} else {
go cpuUtilization(idservice.NewIDFromString(*id))
replica(idservice.NewIDFromString(*id))
log.Debugf("Server done")
}
Expand Down