apr_socket_recv: Software in your host aborted an established connection.

a58438331 注册会员
2023-02-27 16:41

Part of this answer refers to GPT, GPT_Pro better solution
First, the ab command is a performance test tool provided by Apache, used to test the performance of the Web server. In Windows, when the number of threads is greater than 15, "apr_socket_recv: The software in your host aborted an established connection. "(730053)".

This error is usually caused by the server's insufficient capacity to process all threads, resulting in the above error. In the same segment network, because the communication time between the same segment network is short, it can better withstand a large number of concurrent access. However, in the case of an out-of-segment network, the throughput is greatly affected due to the long communication time. Therefore, the above situation occurs.

To solve this problem, first check whether the server is running out of memory or CPU. If so, consider expanding the memory and CPU capacity of the server. In addition, CDN acceleration can be considered to reduce the communication time between remote networks, so as to achieve the purpose of improving throughput. In addition, you can also consider optimizations on the server side, such as reducing processing time per request, using Memcache to reduce database queries, avoiding unnecessary queries, optimizing SQL statements, and using Gzip to compress static files.

// 代码片段1
// 减少每个请求所需要的处理时间
// 如使用Memcache来减少数据库查询
$memcache = new Memcache;
$memcache->connect('', 11211);
$data = $memcache->get('key');
if ($data !== false) {
    // 如果数据存在缓存中,则直接从缓存中获取数据
    $data = $memcache->get('key');
} else {
    // 如果数据不存在,则从数据库中获取数据
    $data = db_fetch($sql);

    // 并将数据存储到缓存中
// 代码片段2
// 使用Gzip来压缩静态文件
if(extension_loaded('zlib')){   //判断php是否开启zlib  
    ob_start('ob_gzhandler');     //开启ob_gzhandler  
   header('Content-Type: text/css; charset=utf-8');   //定义文件头信息  
   header('Cache-Control: max-age=86400');      //定义文件有效期  
   header('Expires: '. gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');   //定义文件头信息  
echo $data;     //定义css内容  
if(extension_loaded('zlib')){   //判断php是否开启zlib  
    ob_end_flush();     //关闭ob_gzhandler  

If the answer is helpful, please accept it.

About the Author

Question Info

Publish Time
2023-02-27 16:41
Update Time
2023-02-27 16:41

Related Question



Html NODEJS websocket引用


带有express和socket的Node js.IO -无法找到socket.io.js

uniapp websocket 发送 sub 监听后,代码自动发送了 unsub ,解除了监听


请问 new WebSocket Request method 'GET' not supported

pyhton flask_socketio uniapp 项目示例