2016-05-28 4 views
1

LAMPサーバー上でアプリケーションを実行しているときに不具合があります。 私はこのシナリオを説明します、そして、私は私の構成といくつかのAB結果を教えます。LAMPサーバーがクラッシュしていますが、メモリとプロセッサーの使用率が低い

私はLaravel 4.2で開発されたアプリケーションを実行しています。 これはクイズゲームです。特定の時間にグループごとに4人のユーザーとグループクイズがあります。 この段階に達すると、JSタイマーは不正確なので、正確な時刻をチェックするために、データベースに3秒ごとにリクエストし、現在の時刻をデータベースに保存するように要求します)、2秒ごとにチェックします

私のサーバは200,300人のユーザが同時に対処していますが、400人に達すると500人のユーザになります。すべてのサーバが非常に遅くなり始めます。悪夢となり、誰ももう遊べない。

ajaxリクエストは、ループやジョインなどのアプリケーションの速度を低下させることなく、選択と挿入のクエリを持つシンプルなPHPファイルです。

ここにいくつかの情報があります: サーバ設定: RAMNodeの-SSD VPS。 -8GB RAM - 40ギガバイトSSD - 4 vCores

サービス情報: Ubuntuのサーバ14.4 のApache 2.4.7 PHP 5.5.9 のMySQL 5.5.47 Laravel 4.2

私が持っていませんこのサーバー上で実行されている他のサービス。 ピーク時のメモリ使用量(グループゲームを同時に実行している600人のユーザー):1.5GB プロセッサ使用率:22%

AB結果:

[email protected]:~# ab -r -n 27000 -c 900 -k -H "Accept-Encoding: gzip,    deflate" http://repensegame.com.br/shout_benchmark.php 
This is ApacheBench, Version 2.3 <$Revision: 1528965 $> 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Licensed to The Apache Software Foundation, http://www.apache.org/ 

Benchmarking repensegame.com.br (be patient) 
Completed 2700 requests 
Completed 5400 requests 
Completed 8100 requests 
Completed 10800 requests 
Completed 13500 requests 
Completed 16200 requests 
Completed 18900 requests 
Completed 21600 requests 
Completed 24300 requests 
Completed 27000 requests 
Finished 27000 requests 


Server Software:  Apache/2.4.7 
Server Hostname:  repensegame.com.br 
Server Port:   80 

Document Path:   /shout_benchmark.php 
Document Length:  687 bytes 

Concurrency Level:  900 
Time taken for tests: 157.934 seconds 
Complete requests:  27000 
Failed requests:  10265 
(Connect: 0, Receive: 296, Length: 9673, Exceptions: 296) 
Keep-Alive requests: 0 
Total transferred:  24637886 bytes 
HTML transferred:  18335742 bytes 
Requests per second: 170.96 [#/sec] (mean) 
Time per request:  5264.454 [ms] (mean) 
Time per request:  5.849 [ms] (mean, across all concurrent requests) 
Transfer rate:   152.35 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 113 942.5  0 15004 
Processing: 63 2302 11425.2 581 121540 
Waiting:  0 1300 6014.9 579 102647 
Total:   91 2415 11791.8 583 122541 

Percentage of the requests served within a certain time (ms) 
    50% 583 
    66% 600 
    75% 611 
    80% 621 
    90% 684 
    95% 1554 
    98% 60434 
    99% 64164 
100% 122541 (longest request) 
[email protected]:~# free -m 
      total  used  free  shared buffers  cached 
Mem:   8192  1518  6673   72   0  1318 
-/+ buffers/cache:  200  7991 
Swap:   256   0  256 
[email protected]:~# 

のhttpd.conf:

<IfModule mpm_worker_module> 
    StartServers 10 
    MinSpareServers 8 
    MaxSpareServers 128 
    MaxClients 2048 
    ServerLimit 8000 
</IfModule> 

<Directory /> 
    Options FollowSymLinks 
    AllowOverride All 
    Require all denied 
</Directory> 

<Directory /usr/share> 
    AllowOverride None 
    Require all granted 
</Directory> 

<Directory /var/www/> 
    Options Indexes FollowSymLinks 
    AllowOverride All 
    Require all granted 
</Directory> 

AccessFileName .htaccess 

<FilesMatch "^\.ht"> 
    Require all denied 
</FilesMatch> 
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User- Agent}i\"" vhost_combined 
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""  combined 
LogFormat "%h %l %u %t \"%r\" %>s %O" common 
LogFormat "%{Referer}i -> %U" referer 
LogFormat "%{User-agent}i" agent 

IncludeOptional conf-enabled/*.conf 

IncludeOptional sites-enabled/*.conf 

ExtendedStatus On 

バーチャルホストのconf:

<VirtualHost *> 
    DocumentRoot /var/www/html/public 
    ServerName repensegame.com.br 
    <Directory /var/www/html/public> 
      allow from all 
      Options None 
      Require all granted 
    </Directory> 
    <Location /server-status> 
     SetHandler server-status 
     Order Deny,Allow 
     Deny from all 
     Allow from localhost 
    </Location> 
    ServerAlias *.repensegame.com.br 
</VirtualHost> 

私は遅いクエリを検出しませんでした。

これだけです。 壁紙には申し訳ありません。

ありがとうございます。

+0

あなたがabでホームページを打つことは、何の役に立つ結果にもつながりません。ユーザーがアクセスしなければならないアクセスページです。訪問する必要があります。とにかく500人の同時ユーザーがかなり多くのことを知っています。これは、ハードウェアが処理できるユーザーの最大数である可能性があります。 – e4c5

答えて

0

MaxClients = 2048は致命的です。私は20を推奨する傾向があります。あなたは300が大丈夫かもしれないと指摘しました。しかし、それはベンチマークのためのものでしたか?本当の人生じゃない?

max_connectionsがそれより小さい場合は特に悪いです。

(アプリケーションによって異なります)いくつかの点で、代わりのが要求を取得し、要求をキューに優れているだけで、それは、それによってスループットを向上せずに応答時間を遅らせる、リソースを競合持って、始めました。

SHOW STATUS LIKE 'Max_used_connections';とは何ですか? innodb_buffer_pool_sizeとは何ですか? (それはそうであるべきであるよりも低いように聞こえる。)

関連する問題