running load tests

This commit is contained in:
Radu Ioan Fericean
2013-08-07 18:18:44 +03:00
parent 305dca0fc9
commit 48fb53ac08
7 changed files with 24 additions and 23 deletions

View File

@@ -30,7 +30,7 @@ import (
)
var (
balancer = flag.String("balancer", "localhost:2001", "balancer server address")
balancer = flag.String("balancer", "localhost:2012", "balancer server address")
runs = flag.Int("runs", 10000, "stress cycle number")
parallel = flag.Int("parallel", 0, "run n requests in parallel")
json = flag.Bool("json", false, "use JSON for RPC encoding")
@@ -40,9 +40,9 @@ func main() {
flag.Parse()
runtime.GOMAXPROCS(runtime.NumCPU())
t1 := time.Date(2012, time.February, 02, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC)
cd := engine.CallDescriptor{Direction: "*out", TOR: "0", Tenant: "vdf", Subject: "rif", Destination: "0256", TimeStart: t1, TimeEnd: t2}
t1 := time.Date(2013, time.August, 07, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2013, time.August, 07, 18, 30, 0, 0, time.UTC)
cd := engine.CallDescriptor{Direction: "*out", TOR: "call", Tenant: "cgrates.org", Subject: "1001", Destination: "+49", TimeStart: t1, TimeEnd: t2}
result := engine.CallCost{}
var client *rpc.Client
var err error
@@ -65,7 +65,7 @@ func main() {
client.Call("Responder.GetCost", cd, &result)
<-sem
finish <- 1
// divCall = client.Go("Responder.GetCost", cd, &result, nil)
// divCall = client.Go("Responder.GetCost", cd, &result, nil)
}()
}
for i := 0; i < *runs; i++ {

View File

@@ -43,15 +43,15 @@ class JSONClient(object):
rpc =JSONClient(("127.0.0.1", 2012))
cd = {"Direction":"*out", "TOR":"0", "Tenant": "vdf", "Subject": "rif", "DestinationPrefix": "0256", "TimeStart": "2012-02-02T17:30:00Z", "TimeEnd": "2012-02-02T18:30:00Z"}
cd = {"Direction":"*out", "TOR":"call", "Tenant": "cgrates.org", "Subject": "1001", "Destination": "+49", "TimeStart": "2013-08-07T17:30:00Z", "TimeEnd": "2013-08-07T18:30:00Z"}
# alternative to the above
s = socket.create_connection(("127.0.0.1", 2012))
s.sendall(json.dumps(({"id": 1, "method": "Responder.GetCost", "params": [cd]})))
print s.recv(4096)
#s = socket.create_connection(("127.0.0.1", 2012))
#s.sendall(json.dumps({"id": 1, "method": "Responder.GetCost", "params": [cd]}))
#print(s.recv(4096))
i = 0
result = ""
for i in xrange(int(1e5) + 1):
for i in range(int(1e5) + 1):
result = rpc.call("Responder.GetCost", cd)
print i, result
print(i, result)

View File

@@ -55,9 +55,10 @@ func main() {
f.Close()
return
}
t1 := time.Date(2012, time.February, 02, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC)
cd := engine.CallDescriptor{Direction: "*out", TOR: "0", Tenant: "vdf", Subject: "rif", Destination: "0256", TimeStart: t1, TimeEnd: t2}
t1 := time.Date(2013, time.August, 07, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2013, time.August, 07, 18, 30, 0, 0, time.UTC)
//cd := engine.CallDescriptor{Direction: "*out", TOR: "0", Tenant: "vdf", Subject: "rif", Destination: "0256", TimeStart: t1, TimeEnd: t2}
cd := engine.CallDescriptor{Direction: "*out", TOR: "call", Tenant: "cgrates.org", Subject: "rif", Destination: "+49", TimeStart: t1, TimeEnd: t2}
getter, err := engine.NewRedisStorage("localhost:6379", 10, "")
//getter, err := engine.NewMongoStorage("localhost", "cgrates")

View File

@@ -1,7 +1,7 @@
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight
LANDLINE_PEAK,0.02,0.02,60s,60s,0,*up,4,10
LANDLINE_PEAK,0.02,0.02,60s,60s,0s,*up,4,10
LANDLINE_PEAK,0.02,0.01,1s,1s,60s,*up,4,10
MOBILE_PEAK,0.02,0.14,60s,60s,0,*up,4,10
LANDLINE_OFFPEAK,1,0,60s,60s,0,*up,4,10
MOBILE_PEAK,0.02,0.14,60s,60s,0s,*up,4,10
LANDLINE_OFFPEAK,1,0,60s,60s,0s,*up,4,10
MOBILE_OFFPEAK,0.02,0.1,60s,60s,0,*up,4,10
RT_FS_USERS,0,0,60s,60s,0,*up,0,10
RT_FS_USERS,0,0,60s,60s,0s,*up,0,10
1 #Tag ConnectFee Rate RateUnit RateIncrement GroupIntervalStart RoundingMethod RoundingDecimals Weight
2 LANDLINE_PEAK 0.02 0.02 60s 60s 0 0s *up 4 10
3 LANDLINE_PEAK 0.02 0.01 1s 1s 60s *up 4 10
4 MOBILE_PEAK 0.02 0.14 60s 60s 0 0s *up 4 10
5 LANDLINE_OFFPEAK 1 0 60s 60s 0 0s *up 4 10
6 MOBILE_OFFPEAK 0.02 0.1 60s 60s 0 *up 4 10
7 RT_FS_USERS 0 0 60s 60s 0 0s *up 0 10

View File

@@ -1,2 +1,2 @@
#Tag,ConnectFee,Rate,RatedUnits,RateIncrements,GroupInterval,RoundingMethod,RoundingDecimals,Weight
1CENTPERSEC,0,0.01,1,1,0,*middle,4,10
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight
1CENTPERSEC,0,0.01,1s,1s,0s,*middle,4,10
1 #Tag ConnectFee Rate RatedUnits RateUnit RateIncrements RateIncrement GroupInterval GroupIntervalStart RoundingMethod RoundingDecimals Weight
2 1CENTPERSEC 0 0.01 1 1s 1 1s 0 0s *middle 4 10

View File

@@ -290,7 +290,7 @@ func (cd *CallDescriptor) GetCost() (*CallCost, error) {
Cost: cost,
ConnectFee: connectionFee,
Timespans: timespans}
Logger.Info(fmt.Sprintf("<Rater> Get Cost: %s => %v", cd.GetKey(), cc))
//Logger.Info(fmt.Sprintf("<Rater> Get Cost: %s => %v", cd.GetKey(), cc))
return cc, err
}

View File

@@ -220,8 +220,8 @@ var FileValidators = map[string]*FileLineRegexValidator{
regexp.MustCompile(`(?:\w+\s*,\s*){1}(?:\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*){4}(?:\d{2}:\d{2}:\d{2}|\*asap){1}$`),
"Tag([0-9A-Za-z_]),Years([0-9;]|*all|<empty>),Months([0-9;]|*all|<empty>),MonthDays([0-9;]|*all|<empty>),WeekDays([0-9;]|*all|<empty>),Time([0-9:]|*asap)"},
utils.RATES_CSV: &FileLineRegexValidator{utils.RATES_NRCOLS,
regexp.MustCompile(`(?:\w+\s*,\s*){1}(?:\d+\.?\d*,){5}(?:\*\w+,){1}(?:\d+\.?\d*,?){2}$`),
"Tag([0-9A-Za-z_]),ConnectFee([0-9.]),Rate([0-9.]),RatedUnits([0-9.]),RateIncrement([0-9.])"},
regexp.MustCompile(`(?:\w+\s*,\s*){1}(?:\d+\.?\d*,){2}(?:\d+s*,){3}(?:\*\w+,){1}(?:\d+\.?\d*,?){2}$`),
"Tag([0-9A-Za-z_]),ConnectFee([0-9.]),Rate([0-9.]),RateUnit([0-9.]),RateIncrementStart([0-9.])"},
utils.DESTINATION_RATES_CSV: &FileLineRegexValidator{utils.DESTINATION_RATES_NRCOLS,
regexp.MustCompile(`(?:\w+\s*,?\s*){3}$`),
"Tag([0-9A-Za-z_]),DestinationsTag([0-9A-Za-z_]),RateTag([0-9A-Za-z_])"},