mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-07-15 02:21:09 +08:00
Merge 8e08b5c72881e04647310f3d6149f4b22ab12215 into bed81af75c46078303102c57dd805a13569777d0
This commit is contained in:
commit
cabc62b1ec
19
test/stress-test-v2/README.md
Normal file
19
test/stress-test-v2/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Stress Test V2
|
||||
|
||||
## Usage
|
||||
|
||||
You need set `TestTargetUserList` variables.
|
||||
|
||||
### Build
|
||||
|
||||
```bash
|
||||
|
||||
go build -o test/stress-test-v2/stress-test-v2 test/stress-test-v2/main.go
|
||||
```
|
||||
|
||||
### Excute
|
||||
|
||||
```bash
|
||||
|
||||
tools/stress-test-v2/stress-test-v2 -c config/
|
||||
```
|
||||
@ -161,7 +161,7 @@ func (st *StressTest) PostRequest(ctx context.Context, url string, reqbody any)
|
||||
|
||||
if baseResp.ErrCode != 0 {
|
||||
err = fmt.Errorf(baseResp.ErrMsg)
|
||||
log.ZError(ctx, "Failed to send request", err, "url", url, "reqbody", reqbody, "resp", baseResp)
|
||||
// log.ZError(ctx, "Failed to send request", err, "url", url, "reqbody", reqbody, "resp", baseResp)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -530,9 +530,20 @@ func main() {
|
||||
// Create 100K groups
|
||||
st.Wg.Add(1)
|
||||
go func(idx int) {
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedTime := time.Since(startTime)
|
||||
log.ZInfo(st.Ctx, "100K group creation completed",
|
||||
"groupID", fmt.Sprintf("v2_StressTest_Group_100K_%d", idx),
|
||||
"index", idx,
|
||||
"duration", elapsedTime.String())
|
||||
}()
|
||||
|
||||
defer st.Wg.Done()
|
||||
defer func() {
|
||||
st.Mutex.Lock()
|
||||
st.Create100kGroupCounter++
|
||||
st.Mutex.Unlock()
|
||||
}()
|
||||
|
||||
groupID := fmt.Sprintf("v2_StressTest_Group_100K_%d", idx)
|
||||
@ -556,7 +567,7 @@ func main() {
|
||||
}
|
||||
|
||||
if len(InviteUserIDs) == 0 {
|
||||
log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
// log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -567,7 +578,7 @@ func main() {
|
||||
}
|
||||
|
||||
if len(InviteUserIDs) == 0 {
|
||||
log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
// log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -602,9 +613,20 @@ func main() {
|
||||
// Create 999 groups
|
||||
st.Wg.Add(1)
|
||||
go func(idx int) {
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedTime := time.Since(startTime)
|
||||
log.ZInfo(st.Ctx, "999 group creation completed",
|
||||
"groupID", fmt.Sprintf("v2_StressTest_Group_1K_%d", idx),
|
||||
"index", idx,
|
||||
"duration", elapsedTime.String())
|
||||
}()
|
||||
|
||||
defer st.Wg.Done()
|
||||
defer func() {
|
||||
st.Mutex.Lock()
|
||||
st.Create999GroupCounter++
|
||||
st.Mutex.Unlock()
|
||||
}()
|
||||
|
||||
groupID := fmt.Sprintf("v2_StressTest_Group_1K_%d", idx)
|
||||
@ -627,7 +649,7 @@ func main() {
|
||||
}
|
||||
|
||||
if len(InviteUserIDs) == 0 {
|
||||
log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
// log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -638,7 +660,7 @@ func main() {
|
||||
}
|
||||
|
||||
if len(InviteUserIDs) == 0 {
|
||||
log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
// log.ZWarn(st.Ctx, "InviteUserIDs is empty", nil, "groupID", groupID)
|
||||
continue
|
||||
}
|
||||
|
||||
19
test/stress-test/README.md
Normal file
19
test/stress-test/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Stress Test
|
||||
|
||||
## Usage
|
||||
|
||||
You need set `TestTargetUserList` and `DefaultGroupID` variables.
|
||||
|
||||
### Build
|
||||
|
||||
```bash
|
||||
|
||||
go build -o test/stress-test/stress-test test/stress-test/main.go
|
||||
```
|
||||
|
||||
### Excute
|
||||
|
||||
```bash
|
||||
|
||||
tools/stress-test/stress-test -c config/
|
||||
```
|
||||
@ -1,25 +0,0 @@
|
||||
# Stress Test
|
||||
|
||||
## Usage
|
||||
|
||||
You need set `TestTargetUserList` and `DefaultGroupID` variables.
|
||||
|
||||
### Build
|
||||
|
||||
```bash
|
||||
go build -o _output/bin/tools/linux/amd64/stress-test tools/stress-test/main.go
|
||||
|
||||
# or
|
||||
|
||||
go build -o tools/stress-test/stress-test tools/stress-test/main.go
|
||||
```
|
||||
|
||||
### Excute
|
||||
|
||||
```bash
|
||||
_output/bin/tools/linux/amd64/stress-test -c config/
|
||||
|
||||
#or
|
||||
|
||||
tools/stress-test/stress-test -c config/
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user