English 中文(简体)
采用博士基准的住户抽样调查比应当慢
原标题:PHP running Drupal benchmark is slower than it should be

最初,我在上公布。 服务器Fault,但也许更多的是PHP的同质问题。

我拥有一台服务器,其核心L5420运行时间为2.5GHz。 我先是优化我的服务器,最后的瓶颈:PHP。

我非常简单的购买力平价:

/test.php

<?php print_r(posix_getpwuid(posix_getuid()));

我的无意识-神论-神论 偿还-留级-视距-视距-中等-中等-中等-中等-中等-中等-中等-中等-中等 文字:

./benchmark-php

#!/bin/bash
if [ -z $1 ]; then
  LIMIT=10
else
  LIMIT=$1
fi

if [ -z $2 ]; then
  SCRIPT="index.php"
else
  SCRIPT=$2
fi

START=$(date +%s.%N)
COUNT=0
while (( $COUNT < $LIMIT ))
do
  php $SCRIPT > /dev/null
  COUNT=$(echo "$COUNT + 1" | bc)
done
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
REQS_PER_SEC=$(echo "scale=2; $COUNT / $DIFF" | bc)
echo $REQS_PER_SEC

/really-benchmark-php

#!/bin/bash
if [ -z $1 ]; then
  LIMIT=10
else
  LIMIT=$1
fi

if [ -z $2 ]; then
  THREADS=16
else
  THREADS=$2
fi

if [ -z $3 ]; then
  SCRIPT="index.php"
else
  SCRIPT=$3
fi

PIDS=""

echo    > results
for thread in `seq 1 $THREADS`; do
  ./benchmark-php $LIMIT $SCRIPT >> results &
  PIDS="$PIDS $!"
done

for PID in $PIDS; do
  wait $PID
done

RESULTS=`cat results`
MATH="0"
for RESULT in $RESULTS; do
  MATH="$MATH + $RESULT"
done

echo "$MATH" | bc

The result of running /really-benchmark-php 100 8 test.php is ~137 requests per second.

• 在Trupal 返回的 s或我的板动力状态上打上同样的文字

我已经安装了装甲运兵车和午餐,我已经核实,他们会因违约而重新运行。 (Yes,装甲运兵车使_cli也在车上。) 是否有人知道“快车花板”的开关?

我有一个替代配置(FPM/FastCGI),为MySQL Drupal安装的~140 q/s服务......如果PHP本身甚至能够从指挥线向2 req/s提供服务,那么如何能够做到这一点?

固定网页:ab -n1000 -c 100 http://x.x.x/ 二次请求: 683.71

test php: ab -n 100 -c 5 http://x.x.x.x/ Requests per second: 41.38

drupal-mysql: ab -n 100 -c 10 http://x.x.x.x/drupal/ Requests per second: 0.24

drupal-sqlite: ab -n 100 -c 10 http://x.x.x.x/drupal-test/ Requests per second: 4.92

最佳回答

顶级核心(不鼓励、无预设能力、没有电能的电离层)对于每秒的运行/页面观测是可怕的。

www.un.org/Depts/DGACM/index_french.htm 使用Valnish或其他一些相反的代理藏身。

总体而言,令人印象深刻。 我控制了167407.84%的页面访问量,我可以每秒处理一次。

Start: 0.51
End : 854.29

这里是业绩和业绩的差异。

我的岗位上的一些相关信标显示了不同的数字。

Test 1 (Get the Starting Benchmark)

A. 滚轴基准

ab -k -n 100 -c 100 -g step1.txt http://example.com/how-it-work

Okay, so this request totally killed my server. See the graph below.

“entergraph

因此,我决定减少这些要求,以便仅列出每秒的粗略标准要求。 我收到了100项请求,达到2项一致。

也是这样:

Concurrency Level:      2
Time taken for tests:   197.855 seconds
Complete requests:      100
Requests per second: 0.51 [#/sec] (mean)
Time per request: 3957.105 [ms] (mean)

Test 2 APC Enabled

然后,我重复了这一试验,但得到了装甲运兵车的帮助。

Concurrency Level:      2
Time taken for tests:   87.270 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      2138900 bytes
HTML transferred:       2096300 bytes
Requests per second:    1.15 [#/sec] (mean)
Time per request:       1745.396 [ms] (mean)
Time per request:       872.698 [ms] (mean, across all concurrent requests)

你可以看到,这明显更好。 但仍有<>周全>。 第二次请求? 页: 1 这是可怕的。

Test 3 - Enable Drupal Core Caching

然后,我使博士核心教学得以进行,并重复了阿普切基准。

ab -k -n 100 -c 5 -g test2-c5-k.txt http://example.com/how-it-work

Concurrency Level:      2
Time taken for tests:   23.229 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      1923002 bytes
HTML transferred:       1880900 bytes
Requests per second:    4.30 [#/sec] (mean)
Time per request:       464.580 [ms] (mean)
Time per request:       232.290 [ms] (mean, across all concurrent requests)
Transfer rate:          80.84 [Kbytes/sec] received

因此,我现在最后提出4项请求。 情况较好,但总体上仍然很严重。

最后一步,在混合体中添加了相反的代谢应用。 我希望看到什么? 我实际上不关心,任何事情都好于每秒4次。 如果我能第二次收到大约300份请求,那么我会感到高兴。 将近1 000项要求,我的要求是静态的。

这是我最后总结的:

Concurrency Level:      300
Time taken for tests:   11.706 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    10000
Total transferred:      190260000 bytes
HTML transferred:       185140000 bytes
Requests per second:    854.29 [#/sec] (mean)
Time per request:       351.168 [ms] (mean)

总体而言,令人印象深刻。 我管理了167407.84%的百分数,要求我处理第二页。

Start: 0.51
End : 854.29

此外,我将每份请求的页装时间从1978年降至1.17万(同时),总速收益为:抽签<>。 速度下降99.94%。 Ouch。

“enterography

enter image description here

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...