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

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

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

5. View the performance test PTS/report details, the total number of requests is 4.9W. as shown in 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

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