Compare commits

..

2 Commits

Author SHA1 Message Date
luhuaei 6781e93d07 rename zabbix to zbbx 2023-04-23 16:14:59 +08:00
luhuaei 6f5f1120ae add 报告.md 2023-04-23 11:38:33 +08:00
6 changed files with 152 additions and 16 deletions

View File

@ -1,3 +1,3 @@
module zabbix-bench
module zbbx-bench
go 1.20

View File

@ -10,7 +10,7 @@ import (
"sync"
"syscall"
"time"
"zabbix-bench/zabbix"
"zbbx-bench/zbbx"
)
var (
@ -19,8 +19,8 @@ var (
argClinetName = flag.String("client-format", "client-%d", "format of client name")
argPacketSize = flag.Int("packet-size", 400, "count of metric in packet")
argMetricName = flag.String("metric-format", "metric-%d", "format of metric name in packet")
argPacketDelay = flag.Duration("packet-delay", 60*time.Second, "delay of send packet")
argZabbix = flag.String("zabbix", "127.0.0.1:10051", "address of zabbix server")
argPacketDelay = flag.Duration("packet-delay", time.Second, "delay of send packet")
argZbbx = flag.String("server", "127.0.0.1:10051", "address of server server")
argMaxMetrics = flag.Int("max-metrics", 0, "max number of metrics each client sends")
argMaxDuration = flag.Duration("max-duration", 0, "max duration of benchmark test")
@ -86,21 +86,21 @@ func main() {
}
// client of zabbix server
// client of zbbx server
type client struct {
id int
host string
sender *zabbix.Sender
sender *zbbx.Sender
}
// generate and send zabbix packet
// generate and send zbbx packet
func (c *client) send() error {
now := time.Now().Unix()
metrics := make([]*zabbix.Metric, 0)
metrics := make([]*zbbx.Metric, 0)
for i := 0; i < *argPacketSize; i++ {
metrics = append(metrics, zabbix.NewMetric(c.host, fmt.Sprintf(*argMetricName, i), fmt.Sprintf("%d", i), now))
metrics = append(metrics, zbbx.NewMetric(c.host, fmt.Sprintf(*argMetricName, i), fmt.Sprintf("%d", i), now))
}
return c.sender.Send(zabbix.NewPacket(metrics, now))
return c.sender.Send(zbbx.NewPacket(metrics, now))
}
func StartClient(id int) {
@ -108,7 +108,7 @@ func StartClient(id int) {
c := &client{
id: id,
host: fmt.Sprintf(*argClinetName, id),
sender: zabbix.NewSender(*argZabbix),
sender: zbbx.NewSender(*argZbbx),
}
ticker := time.Tick(*argPacketDelay)
for {

View File

@ -1,4 +1,4 @@
package zabbix
package zbbx
import (
"time"

View File

@ -1,4 +1,4 @@
package zabbix
package zbbx
import (
"encoding/binary"

View File

@ -1,4 +1,4 @@
package zabbix
package zbbx
import (
"fmt"
@ -17,7 +17,7 @@ type Sender struct {
func NewSender(address string) *Sender {
s := &Sender{address: address}
if err := s.resolv(); err != nil {
os.Stderr.WriteString(fmt.Sprintf("Can't resolv zabbix address: %s\n", err.Error()))
os.Stderr.WriteString(fmt.Sprintf("Can't resolv address: %s\n", err.Error()))
os.Exit(1)
}
return s
@ -61,7 +61,7 @@ func (s *Sender) Send(packet *Packet) error {
_, err = s.read(conn)
if err != nil {
fmt.Fprintf(os.Stderr, "Read zabbix response error: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "Read response error: %s\n", err.Error())
}
return conn.Close()

136
报告.md Normal file
View File

@ -0,0 +1,136 @@
# 测试输出
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
```