nginx、php-fpm ではエラーが発生するが、apache ではエラーは発生しない

nginx、php-fpm ではエラーが発生するが、apache ではエラーは発生しない

私は nginx、fastcgi を使用してデプロイされた opencart アプリケーションを持っています。Mysql サーバーとして RDS を使用しています。

最近、ログにこのエラーが記録され、400人の同時ユーザーに対してSiegeで負荷テストを実行しました。このエラーが発生しています。

FastCGI sent in stderr: "PHP message: PHP Warning: mysqli::mysqli

Apacheをサーバーとして使用してSiegeで同じ負荷テストを実行中。テストは肯定的な結果をもたらします

これらはnginxによる包囲攻撃の結果です

Transactions:               3246 hits
Availability:              77.80 %
Elapsed time:             146.43 secs
Data transferred:          35.27 MB
Response time:              6.86 secs
Transaction rate:          22.17 trans/sec
Throughput:             0.24 MB/sec
Concurrency:              152.01
Successful transactions:        1049
Failed transactions:             926
Longest transaction:           36.83
Shortest transaction:           0.65

そしてApache

Transactions:               7921 hits
Availability:              99.01 %
Elapsed time:             462.60 secs
Data transferred:         218.75 MB
Response time:              9.94 secs
Transaction rate:          17.12 trans/sec
Throughput:             0.47 MB/sec
Concurrency:              170.12
Successful transactions:        4925
Failed transactions:              79
Longest transaction:          114.25
Shortest transaction:           0.59

これらは nginx と fpm conf です:

user www-data;
worker_processes 1;
pid /run/nginx.pid;

events {
        worker_connections 1024;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        # Compression

        # Enable Gzip compressed.
        gzip on;
        # Enable compression both for HTTP/1.0 and HTTP/1.1.
        #gzip_http_version  1.1;

        # Compression level (1-9).
        # 5 is a perfect compromise between size and cpu usage, offering about
        # 75% reduction for most ascii files (almost identical to level 9).
        gzip_comp_level    4;

        # Don't compress anything that's already small and unlikely to shrink much
        # if at all (the default is 20 bytes, which is bad as that usually leads to
        # larger files after gzipping).
        gzip_min_length    256;

        # Compress data even for clients that are connecting to us via proxies,
        # identified by the "Via" header (required for CloudFront).
        gzip_proxied       any;

        # Tell proxies to cache both the gzipped and regular version of a resource
        # whenever the client's Accept-Encoding capabilities header varies;
        # Avoids the issue where a non-gzip capable client (which is extremely rare
        # today) would display gibberish if their proxy gave them the gzipped version.
        gzip_vary          on;

        # Compress all output labeled with one of the following MIME-types.
        gzip_types
          application/atom+xml
          application/javascript
          application/x-javascript
          application/json
          application/rss+xml
          application/vnd.ms-fontobject
          application/x-font-ttf
          application/x-web-app-manifest+json
          application/xhtml+xml
          application/xml
          font/opentype
          image/svg+xml
          image/x-icon
          text/css
          text/plain
          text/x-component
          text/xml
          text/javascript
          text/x-javascript
        # text/html is always compressed by HttpGzipModule


        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##
        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

関連情報