在Go中实施PoW盾牌以进行压力测试的代码示例

93 阅读1分钟

PoW Shield Go

在Go中实现PoW Shield,用于压力测试。

使用方法

安装该软件包

go mod tidy

运行

go run main.go

压力测试

注意:这只适用于非容器化版本的PoW Shield,在运行测试时你的系统可能会出现不稳定的情况:

# Start the stress test
npm run stress

# If you changed the PORT variable in .env, you should also change the target variable in the stress test script
nano scripts/stress.sh

以下测试是在i7-12700H CPU上进行的,每个并发的参数有1个100%利用率的核心和60秒的时间。

大量GET

并发连接平均延时错误率请求/秒
64毫秒0
12800
256毫秒0
512毫秒0
1024毫秒0
2048毫秒0
4096ms0

Nonce Flood

并发连接平均延时错误率请求/秒
64毫秒不适用
128毫秒不适用
256毫秒不适用
512毫秒不适用
1024毫秒不适用
2048毫秒不适用
4096微秒不适用