Compare commits
No commits in common. "master" and "2c5d8da3c4f6e3bb214d008b7da675e1bb8a6ba8" have entirely different histories.
master
...
2c5d8da3c4
|
|
@ -1,3 +1,3 @@
|
||||||
module zbbx-bench
|
module zabbix-bench
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
|
||||||
20
src/main.go
20
src/main.go
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"zbbx-bench/zbbx"
|
"zabbix-bench/zabbix"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -19,8 +19,8 @@ var (
|
||||||
argClinetName = flag.String("client-format", "client-%d", "format of client name")
|
argClinetName = flag.String("client-format", "client-%d", "format of client name")
|
||||||
argPacketSize = flag.Int("packet-size", 400, "count of metric in packet")
|
argPacketSize = flag.Int("packet-size", 400, "count of metric in packet")
|
||||||
argMetricName = flag.String("metric-format", "metric-%d", "format of metric name in packet")
|
argMetricName = flag.String("metric-format", "metric-%d", "format of metric name in packet")
|
||||||
argPacketDelay = flag.Duration("packet-delay", time.Second, "delay of send packet")
|
argPacketDelay = flag.Duration("packet-delay", 60*time.Second, "delay of send packet")
|
||||||
argZbbx = flag.String("server", "127.0.0.1:10051", "address of server server")
|
argZabbix = flag.String("zabbix", "127.0.0.1:10051", "address of zabbix server")
|
||||||
argMaxMetrics = flag.Int("max-metrics", 0, "max number of metrics each client sends")
|
argMaxMetrics = flag.Int("max-metrics", 0, "max number of metrics each client sends")
|
||||||
argMaxDuration = flag.Duration("max-duration", 0, "max duration of benchmark test")
|
argMaxDuration = flag.Duration("max-duration", 0, "max duration of benchmark test")
|
||||||
|
|
||||||
|
|
@ -86,21 +86,21 @@ func main() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// client of zbbx server
|
// client of zabbix server
|
||||||
type client struct {
|
type client struct {
|
||||||
id int
|
id int
|
||||||
host string
|
host string
|
||||||
sender *zbbx.Sender
|
sender *zabbix.Sender
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate and send zbbx packet
|
// generate and send zabbix packet
|
||||||
func (c *client) send() error {
|
func (c *client) send() error {
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
metrics := make([]*zbbx.Metric, 0)
|
metrics := make([]*zabbix.Metric, 0)
|
||||||
for i := 0; i < *argPacketSize; i++ {
|
for i := 0; i < *argPacketSize; i++ {
|
||||||
metrics = append(metrics, zbbx.NewMetric(c.host, fmt.Sprintf(*argMetricName, i), fmt.Sprintf("%d", i), now))
|
metrics = append(metrics, zabbix.NewMetric(c.host, fmt.Sprintf(*argMetricName, i), fmt.Sprintf("%d", i), now))
|
||||||
}
|
}
|
||||||
return c.sender.Send(zbbx.NewPacket(metrics, now))
|
return c.sender.Send(zabbix.NewPacket(metrics, now))
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartClient(id int) {
|
func StartClient(id int) {
|
||||||
|
|
@ -108,7 +108,7 @@ func StartClient(id int) {
|
||||||
c := &client{
|
c := &client{
|
||||||
id: id,
|
id: id,
|
||||||
host: fmt.Sprintf(*argClinetName, id),
|
host: fmt.Sprintf(*argClinetName, id),
|
||||||
sender: zbbx.NewSender(*argZbbx),
|
sender: zabbix.NewSender(*argZabbix),
|
||||||
}
|
}
|
||||||
ticker := time.Tick(*argPacketDelay)
|
ticker := time.Tick(*argPacketDelay)
|
||||||
for {
|
for {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package zbbx
|
package zabbix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package zbbx
|
package zabbix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package zbbx
|
package zabbix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -17,7 +17,7 @@ type Sender struct {
|
||||||
func NewSender(address string) *Sender {
|
func NewSender(address string) *Sender {
|
||||||
s := &Sender{address: address}
|
s := &Sender{address: address}
|
||||||
if err := s.resolv(); err != nil {
|
if err := s.resolv(); err != nil {
|
||||||
os.Stderr.WriteString(fmt.Sprintf("Can't resolv address: %s\n", err.Error()))
|
os.Stderr.WriteString(fmt.Sprintf("Can't resolv zabbix address: %s\n", err.Error()))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|
@ -61,7 +61,7 @@ func (s *Sender) Send(packet *Packet) error {
|
||||||
|
|
||||||
_, err = s.read(conn)
|
_, err = s.read(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Read response error: %s\n", err.Error())
|
fmt.Fprintf(os.Stderr, "Read zabbix response error: %s\n", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return conn.Close()
|
return conn.Close()
|
||||||
136
报告.md
136
报告.md
|
|
@ -1,136 +0,0 @@
|
||||||
# 测试输出
|
|
||||||
progress 63 s, 104400 metric/s
|
|
||||||
Read zabbix response error: read tcp 192.168.1.95:54754->192.168.1.196:10051: read: connection reset by peer
|
|
||||||
Read zabbix response error: read tcp 192.168.1.95:54816->192.168.1.196:10051: read: connection reset by peer
|
|
||||||
progress 64 s, 118800 metric/s
|
|
||||||
progress 65 s, 133200 metric/s
|
|
||||||
progress 66 s, 44400 metric/s
|
|
||||||
progress 67 s, 129600 metric/s
|
|
||||||
progress 68 s, 90000 metric/s
|
|
||||||
progress 69 s, 79200 metric/s
|
|
||||||
progress 70 s, 80400 metric/s
|
|
||||||
progress 71 s, 101200 metric/s
|
|
||||||
progress 72 s, 32000 metric/s
|
|
||||||
progress 73 s, 42400 metric/s
|
|
||||||
progress 74 s, 400 metric/s
|
|
||||||
progress 75 s, 38000 metric/s
|
|
||||||
progress 76 s, 109200 metric/s
|
|
||||||
progress 77 s, 132400 metric/s
|
|
||||||
progress 78 s, 106400 metric/s
|
|
||||||
progress 79 s, 80000 metric/s
|
|
||||||
progress 80 s, 65600 metric/s
|
|
||||||
progress 81 s, 94400 metric/s
|
|
||||||
progress 82 s, 70400 metric/s
|
|
||||||
progress 83 s, 89600 metric/s
|
|
||||||
Read zabbix response error: read tcp 192.168.1.95:47306->192.168.1.196:10051: read: connection reset by peer
|
|
||||||
Read zabbix response error: read tcp 192.168.1.95:47410->192.168.1.196:10051: read: connection reset by peer
|
|
||||||
Read zabbix response error: read tcp 192.168.1.95:47268->192.168.1.196:10051: read: connection reset by peer
|
|
||||||
...
|
|
||||||
-----------------------------
|
|
||||||
Total processed: 6293200 (53788 metric/s)
|
|
||||||
|
|
||||||
# 测试机器
|
|
||||||
```
|
|
||||||
NAME="Kylin"
|
|
||||||
VERSION="银河麒麟桌面操作系统V10 (SP1)"
|
|
||||||
VERSION_US="Kylin Linux Desktop V10 (SP1)"
|
|
||||||
ID=kylin
|
|
||||||
ID_LIKE=debian
|
|
||||||
PRETTY_NAME="Kylin V10 SP1"
|
|
||||||
VERSION_ID="v10"
|
|
||||||
HOME_URL="http://www.kylinos.cn/"
|
|
||||||
SUPPORT_URL="http://www.kylinos.cn/support/technology.html"
|
|
||||||
BUG_REPORT_URL="http://www.kylinos.cn/"
|
|
||||||
PRIVACY_POLICY_URL="http://www.kylinos.cn"
|
|
||||||
VERSION_CODENAME=kylin
|
|
||||||
UBUNTU_CODENAME=kylin
|
|
||||||
PROJECT_CODENAME=v10sp1
|
|
||||||
```
|
|
||||||
|
|
||||||
# cpu 信息
|
|
||||||
```
|
|
||||||
processor : 0
|
|
||||||
model name : phytium FT1500a
|
|
||||||
bogomips : 3590.55
|
|
||||||
flags : fp asimd evtstrm aes pmull sha1 sha2 crc32
|
|
||||||
CPU implementer : 0x70
|
|
||||||
CPU architecture: 8
|
|
||||||
CPU variant : 0x1
|
|
||||||
CPU part : 0x660
|
|
||||||
CPU revision : 1
|
|
||||||
|
|
||||||
processor : 1
|
|
||||||
model name : phytium FT1500a
|
|
||||||
bogomips : 3590.55
|
|
||||||
flags : fp asimd evtstrm aes pmull sha1 sha2 crc32
|
|
||||||
CPU implementer : 0x70
|
|
||||||
CPU architecture: 8
|
|
||||||
CPU variant : 0x1
|
|
||||||
CPU part : 0x660
|
|
||||||
CPU revision : 1
|
|
||||||
|
|
||||||
processor : 2
|
|
||||||
model name : phytium FT1500a
|
|
||||||
bogomips : 3590.55
|
|
||||||
flags : fp asimd evtstrm aes pmull sha1 sha2 crc32
|
|
||||||
CPU implementer : 0x70
|
|
||||||
CPU architecture: 8
|
|
||||||
CPU variant : 0x1
|
|
||||||
CPU part : 0x660
|
|
||||||
CPU revision : 1
|
|
||||||
|
|
||||||
processor : 3
|
|
||||||
model name : phytium FT1500a
|
|
||||||
bogomips : 3590.55
|
|
||||||
flags : fp asimd evtstrm aes pmull sha1 sha2 crc32
|
|
||||||
CPU implementer : 0x70
|
|
||||||
CPU architecture: 8
|
|
||||||
CPU variant : 0x1
|
|
||||||
CPU part : 0x660
|
|
||||||
CPU revision : 1
|
|
||||||
```
|
|
||||||
|
|
||||||
# 内存信息
|
|
||||||
```
|
|
||||||
MemTotal: 8136768 kB
|
|
||||||
MemFree: 212332 kB
|
|
||||||
MemAvailable: 6218200 kB
|
|
||||||
PageSize: 4 kB
|
|
||||||
Buffers: 943244 kB
|
|
||||||
Cached: 2853060 kB
|
|
||||||
SwapCached: 33296 kB
|
|
||||||
Active: 2513404 kB
|
|
||||||
Inactive: 2236840 kB
|
|
||||||
Active(anon): 500656 kB
|
|
||||||
Inactive(anon): 560352 kB
|
|
||||||
Active(file): 2012748 kB
|
|
||||||
Inactive(file): 1676488 kB
|
|
||||||
Unevictable: 24996 kB
|
|
||||||
Mlocked: 24996 kB
|
|
||||||
SwapTotal: 7945212 kB
|
|
||||||
SwapFree: 7615724 kB
|
|
||||||
Dirty: 1084 kB
|
|
||||||
Writeback: 0 kB
|
|
||||||
AnonPages: 949992 kB
|
|
||||||
Mapped: 373932 kB
|
|
||||||
Shmem: 85608 kB
|
|
||||||
Slab: 3031392 kB
|
|
||||||
SReclaimable: 2666068 kB
|
|
||||||
SUnreclaim: 365324 kB
|
|
||||||
KernelStack: 18592 kB
|
|
||||||
PageTables: 49756 kB
|
|
||||||
NFS_Unstable: 0 kB
|
|
||||||
Bounce: 0 kB
|
|
||||||
WritebackTmp: 0 kB
|
|
||||||
CommitLimit: 12013596 kB
|
|
||||||
Committed_AS: 12830668 kB
|
|
||||||
VmallocTotal: 258998208 kB
|
|
||||||
VmallocUsed: 0 kB
|
|
||||||
VmallocChunk: 0 kB
|
|
||||||
AnonHugePages: 444416 kB
|
|
||||||
HugePages_Total: 0
|
|
||||||
HugePages_Free: 0
|
|
||||||
HugePages_Rsvd: 0
|
|
||||||
HugePages_Surp: 0
|
|
||||||
Hugepagesize: 2048 kB
|
|
||||||
```
|
|
||||||
Loading…
Reference in New Issue