There is no problem not worth solving, and no technology not worth learning!

Use Alibaba Cloud Performance Testing PTS to simulate concurrent HTTP requests

查看 性能测试PTS/报告详情,总请求数 4.9w

1. Decide to simulate the case of using file_put_contents() to write the same path file in the test environment at the same time, and then observe whether the read file content is empty.

require.php

<?php
 
$i = rand();
$path = 'return.php';
$contents = [
    'a',
    'b',
    'c',
    'd',
    'e',
    'f',
    'g',
    'h',
    'i',
    'j'
];
 
if (file_exists($path)) {
    $read = file_get_contents($path);
    if (empty($read)) {
        file_put_contents('empty-' . rand() . '.php', $read, LOCK_EX);
    }
}
$code = '<?php';
$code .= "\n\n";
$contents = array_merge($contents, [$i]);
$code .= 'return ' . var_export($contents, true) . ';';
file_put_contents($path, $code, LOCK_EX);
 
?>

2. Since it is only temporarily used, the product type can be deducted from the resource package by quantity, and the experience version of the resource package type is selected, and at the same time, it simulates a maximum of 1,000 virtual users. as shown in Figure 1

由于只是临时使用一下,商品类型选择 按量抵扣资源包 ,资源包类型选择 体验版,同时最多模拟1千个虚拟用户
Figure 1

3. Create a test scenario, select the pressure mode concurrent mode (virtual user mode), increase mode Manual speed regulation, the maximum concurrency is 10, the total pressure test time is 2 minutes, and the estimated consumption is 1000vum. as shown in Figure 2

创建测试场景,压力模式选择 并发模式(虚拟用户模式),递增模式 手动调速,最大并发 10,压测总时长 2 分钟,预估消耗1000VUM
Figure 2

4. Interface test, select the scene just created, performance test PTS / pressure test. as shown in Figure 3

接口测试,选择刚才创建的场景,性能测试PTS/压测中
Figure 3

5. View the performance test PTS/report details, the total number of requests is 4.9W. as shown in Figure 4

查看 性能测试PTS/报告详情,总请求数 4.9w
Figure 4

6. Check the running results of the program, and it is determined that more than 20,000 files are generated, namely: return.php, and a large number of files starting with empty-. as shown in Figure 5

查看程序运行结果,确定生成了 2万多 个文件,分别为:return.php、以及大量以 empty- 开头的文件
Figure 5

Linux Server Operations, Deployment & Production Troubleshooting

If your website or backend service runs on a Linux server and you are facing unstable access, Nginx configuration issues, MySQL / Redis errors, Docker service failures, full disk usage, or high CPU / memory usage, feel free to contact me for remote troubleshooting.

Ideal For:
✅ Website downtime or unstable access
✅ Nginx / PHP-FPM configuration issues
✅ MySQL / Redis performance or connection problems
✅ Docker service deployment and maintenance
✅ Server migration and environment setup
✅ CPU / memory / disk usage investigation

What I Offer:
✅ Linux environment inspection
✅ Website migration and deployment
✅ Nginx / PHP-FPM / MySQL / Redis troubleshooting
✅ Docker configuration and maintenance
✅ Server performance analysis
✅ Long-term remote operations support

Please contact me and mention: Linux Operations Consultation.

Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.