roadrunner-php / laravel-bridge

🌉 RoadRunner ⇆ Laravel bridge 🇺🇦❤️
https://roadrunner.dev/docs/integration-laravel
MIT License
372 stars 25 forks source link

Why do I test according to this example? QPS is very low. Where is it not configured #80

Closed pretty66 closed 2 years ago

pretty66 commented 2 years ago

Why is QPS very low according to this example? Is there a problem with my configuration

tarampampam commented 2 years ago

Hi @pretty66! How can I reproduce described behavior? Could you please make a repository with a demonstration?

pretty66 commented 2 years ago

Hi @pretty66! How can I reproduce described behavior? Could you please make a repository with a demonstration?

Yes, this is my test code:test code

tarampampam commented 2 years ago
diff --git a/.env.example b/.env.example
index b7becba..ba43d82 100644
--- a/.env.example
+++ b/.env.example
@@ -19,7 +19,7 @@ BROADCAST_DRIVER=log
 CACHE_DRIVER=file
 FILESYSTEM_DRIVER=local
 QUEUE_CONNECTION=sync
-SESSION_DRIVER=file
+SESSION_DRIVER=array
 SESSION_LIFETIME=120

 MEMCACHED_HOST=127.0.0.1
$ ln -s ./.env.example ./.env

Before:

$ wrk -d 5 http://127.0.0.1:1876/info
Running 5s test @ http://127.0.0.1:1876/info
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   105.46ms  158.05ms 598.22ms   80.95%
    Req/Sec   322.81    246.03     1.08k    67.74%
  3071 requests in 5.00s, 3.08MB read
Requests/sec:    613.66
Transfer/sec:    630.44KB

After:

$ wrk -d 5 http://127.0.0.1:1876/info
Running 5s test @ http://127.0.0.1:1876/info
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.95ms    1.23ms  28.91ms   94.04%
    Req/Sec     1.29k    76.95     1.43k    74.00%
  12811 requests in 5.00s, 12.85MB read
Requests/sec:   2561.09
Transfer/sec:      2.57MB

Related issue: #23 (one more example)

Bonus: The Dockerfile I used ```Dockerfile # syntax=docker/dockerfile:1.2 # build application runtime, image page: FROM php:7.4-alpine as runtime COPY --from=composer:2.1.14 /usr/bin/composer /usr/bin/composer COPY --from=spiralscout/roadrunner:2.6.1 /usr/bin/rr /usr/bin/rr COPY --from=williamyeh/wrk:4.0.2 /usr/local/bin/wrk /usr/bin/wrk ENV COMPOSER_HOME="/tmp/composer" RUN set -x \ # install permanent dependencies && apk add --no-cache icu-dev \ # install PHP extensions && docker-php-ext-install -j$(nproc) \ sockets \ opcache \ pcntl \ intl \ 1>/dev/null \ # show installed PHP modules && php -m \ # create unprivileged user && adduser \ --disabled-password \ --shell "/sbin/nologin" \ --home "/nonexistent" \ --no-create-home \ --uid "10001" \ --gecos "" \ "appuser" \ # create directory for application sources and roadrunner unix socket && mkdir /app /var/run/rr \ && chown -R appuser:appuser /app /var/run/rr \ && chmod -R 777 /var/run/rr # use an unprivileged user by default USER appuser:appuser # use directory with application sources by default WORKDIR /app # copy composer (json|lock) files for dependencies layer caching COPY --chown=appuser:appuser ./composer.* /app/ # install composer dependencies (autoloader MUST be generated later!) RUN composer install -n --no-dev --no-cache --no-ansi --no-autoloader --no-scripts --prefer-dist # copy application sources into image (completely) COPY --chown=appuser:appuser . /app/ # # copy front-end artifacts into image # COPY --from=frontend --chown=appuser:appuser /app/public /app/public RUN set -x \ # generate composer autoloader and trigger scripts && composer dump-autoload -n --optimize \ # "fix" composer issue "Cannot create cache directory /tmp/composer/cache/..." for docker-compose usage && chmod -R 777 ${COMPOSER_HOME}/cache # unset default image entrypoint ENTRYPOINT [] ```

@pretty66 This issue can be closed?

pretty66 commented 2 years ago

Thank you. The issue can be closed