我需要更改什么httpd conf设置才能增加Apache的最大并发连接数?注意:我关闭了KeepAlive,因为这主要是一个API服务器.
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same …Run Code Online (Sandbox Code Playgroud) 最初,我只想验证会话中的session_start锁定.所以,我创建了一个PHP文件,如下所示.基本上,如果网页浏览是偶数,页面会休眠10秒; 如果网页浏览是奇数,则不是.并且,session_start用于获取$ _SESSION中的页面视图.
我尝试在一个浏览器的两个选项卡中访问该页面.因为我明确地让它睡了所以第一个标签需要10秒就不足为奇了.第二个选项卡不会休眠,但应该被sessiont_start阻止.这按预期工作.
令我惊讶的是,第二页的输出显示session_start几乎没有时间.实际上,整个页面似乎没有时间加载.但是,页面确实需要10秒才能在浏览器中显示.
obtained lock
Cost time: 0.00016689300537109
Start 1269739162.1997
End 1269739162.1998
allover time elpased : 0.00032305717468262
The page views: 101
Run Code Online (Sandbox Code Playgroud)
PHP是否从PHP页面中提取session_start并在其他PHP语句之前执行它?
这是代码.
<?php
function float_time()
{
list($usec, $sec) = explode(' ', microtime());
return (float)$sec + (float)$usec;
}
$allover_start_time = float_time();
$start_time = float_time();
session_start();
echo "obtained lock<br/>";
$end_time = float_time();
$elapsed_time = $end_time - $start_time;
echo "Cost time: $elapsed_time <br>";
echo "Start $start_time<br/>";
echo "End …Run Code Online (Sandbox Code Playgroud)