the-benchmarker / web-frameworks

Which is the fastest web framework?
MIT License
6.91k stars 641 forks source link

Multiple engines, for php #4278

Closed waghanza closed 2 years ago

waghanza commented 3 years ago

Hi,

This PR merge php based implementation so as we can use multiple engines for our analysis.

Failing frameworks

Regards,

bajb commented 3 years ago

As per #3958 we should add workerman to cubex.

Do we have any suggestions on what frameworks should do to implement the additional engines?

RicardoSette commented 3 years ago

Framework Siler use Swoole and PHP-FPM

waghanza commented 3 years ago

As per #3958 we should add workerman to cubex.

Do we have any suggestions on what frameworks should do to implement the additional engines?

It is up to each frameworks. In mean in ruby world (above PR) we can run all framework with puma / iodine / falcon.

However, for some frameworks, it is accurate to run on workerman, others swoole, other both.

leocavalcante commented 3 years ago

Have you something in mind for a thing like "variants of variants"? I mean: Laravel, for example, can run within Swoole through community bridges like laravel-swoole, laravel-s, and now can run through octane. Or only octane will be considered for the swoole variant?

wolfy-j commented 3 years ago

I'm really eager to see the result comparing Laravel on Swoole and RoadRunner using a unified Octane setup.

leocavalcante commented 3 years ago

Yeah, even octane itself could be considered a variant with two sub-variants (swoole and roadrunner). For the sake of simplicity, my suggestion is to use something like:

waghanza commented 3 years ago

octane, could also use road-runner ? awsone. but I've understood that octane is not yet production ready

waghanza commented 3 years ago

Have you something in mind for a thing like "variants of variants"? I mean: Laravel, for example, can run within Swoole through community bridges like laravel-swoole, laravel-s, and now can run through octane. Or only octane will be considered for the swoole variant?

For me, I prefer say that we can use various engines. Indeed, there is a lot of community bridges. I have not really think of something, since there is no such thing in javascript / ruby world, but we can at this smoothly.

PS : I, however, have something in mind (but not very clear). I mean a thing to display : (example - rails on ruby (with multiple engine) but also on jruby / truffleruby ...)

waghanza commented 3 years ago

@wolfy-j I'm trying chubbyphp since I can try with road-runner / swoole / workerman and php-fpm With the following Dockerfile

FROM php:7.4-fpm-alpine

RUN apk add git zlib-dev libzip-dev build-base autoconf nginx openrc curl-dev icu-dev oniguruma-dev 
RUN docker-php-ext-install zip opcache

WORKDIR /usr/src/app

  COPY public/index.php public/index.php
  COPY .road-runner/composer.json composer.json
  COPY .rr.yaml .rr.yaml

  RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  RUN composer install --no-dev --prefer-dist --classmap-authoritative
  RUN composer dumpautoload -o
  RUN vendor/bin/rr get-binary

ENV EVENT_EXT_FILE /usr/local/etc/php/conf.d/docker-php-ext-event.ini
RUN if [[ -f "${EVENT_EXT_FILE}" ]] ; then \
  rm -fr /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini ; \
  sed -e '1i extension=sockets' /usr/local/etc/php/conf.d/docker-php-ext-event.ini > /tmp/file ; \
  mv /tmp/file /usr/local/etc/php/conf.d/docker-php-ext-event.ini ; fi

  CMD ./rr serve

I have

/usr/src/app # ./rr serve
ERRO[0000] [http]: [http]: unable to connect to worker: invalid data found in the buffer (possible echo): signal: killed 
Error: [http]: unable to connect to worker: invalid data found in the buffer (possible echo): signal: killed
leocavalcante commented 3 years ago

I've understood that octane is not yet production ready

It got v1.0 this week https://laravel-news.com/laravel-octane-1-0-0

waghanza commented 3 years ago

have to wait for https://github.com/the-benchmarker/web-frameworks/pull/3655

waghanza commented 3 years ago
/usr/src/app # ./rr serve
ERRO[0000] [http]: [http]: unable to connect to worker: invalid data found in the buffer (possible echo): signal: killed 
Error: [http]: unable to connect to worker: invalid data found in the buffer (possible echo): signal: killed

Nevermind, I forget the worker :-)

waghanza commented 2 years ago

any idea of https://the-benchmarker.semaphoreci.com/jobs/00af9fca-7cb6-44b2-bc3c-4701733b6c8a#L1341 @mruz ?

curl -v http://127.0.0.1:3000/user/0 returns a 200 but $this->dispatcher->getParam('id'); seems to be empty

mruz commented 2 years ago

I think it's because of false value. Can you try:

$this->dispatcher->getParam('id', null, null, true);
waghanza commented 2 years ago

I think it's because of false value. Can you try:

$this->dispatcher->getParam('id', null, null, true);

same

EDIT : the only modified file is php/ice/config.yaml

mruz commented 2 years ago

I just tried on php 8.0.2 and works fine. Can you tell me how to start a container with only the ice fw? I'm getting no file or directory.

make -f .Makefile build 

Can you also debug:

var_dump($this->dispatcher->getParams());
waghanza commented 2 years ago

var_dump($this->dispatcher->getParams());

I find the issue ... nginx config file was wrong (bad yaml config)

waghanza commented 2 years ago

I think I have finished (at least I've fixed all frameworks except codeigniter4 since it fails on master)

could you take a look @laylatichy @leocavalcante @dominikzogg @sy-records @hhxsv5, at least for php files ?