我想使用 siege 对具有不同 url 的 1M 请求进行基准测试,我需要知道我是否可以创建一个 bash 脚本来执行随机循环或 php 脚本来从数据库中读取 url 并创建动态 url 并将此 urls 提供给 siege 命令进行台架测试?
例如我有这种类型的 banner_sizes :
[
{
"id": 1,
"size": "normal_x970h90",
},
{
"id": 2,
"size": "normal_x234h60",
},
{
"id": 3,
"size": "normal_x468h60",
},
{
"id": 4,
"size": "normal_x300h600",
},
{
"id": 5,
"size": "normal_x120h600",
},
{
"id": 6,
"size": "normal_x160h600",
},
{
"id": 7,
"size": "normal_x120h240",
},
{
"id": 8,
"size": "normal_x300h250",
},
{
"id": 9,
"size": "normal_x250h250",
},
{
"id": 10,
"size": "normal_x600h300",
},
{
"id": 11,
"size": "normal_x728h90",
},
{
"id": 12,
"size": "normal_x300h100",
},
{
"id": 13,
"size": "normal_x125h125",
}
]
而且我有这些身份证:
[
0 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#915}
]
1 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#926}
]
2 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#924}
]
3 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#913}
]
4 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#929}
]
5 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#862}
]
6 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#863}
]
7 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#864}
]
8 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#865}
]
9 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#928}
]
10 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#927}
]
11 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#917}
]
12 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#918}
]
13 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#899}
]
14 => array:1 [
"_id" => MongoDB\BSON\ObjectID {#898}
]
]
我需要使用上述信息创建这些类型的 url:
www.example.come/api/is/normal_x234h60/899
www.example.com/api/is/normal_x600h300/898
和更多这样的。
有没有办法创建这个 url 并将它们放在 txt 文件中,然后运行我的 siege 命令:
siege -c10000 -b -t30m -f urls.txt
还是使用 apache ab bench test ?