Skip to content

[php] Reactphp update to PHP/8.4 #9529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions frameworks/PHP/reactphp/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"tests": [{
"default": {
"json_url": "/json",
"db_url": "/db",
"query_url": "/query?q=",
"fortune_url": "/fortunes",
"update_url": "/update?q=",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Realistic",
Expand Down
26 changes: 15 additions & 11 deletions frameworks/PHP/reactphp/reactphp.dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq git unzip wget curl build-essential \
php8.3-cli php8.3-mbstring php8.3-dev php8.3-xml > /dev/null
php8.4-cli php8.4-mbstring php8.4-dev php8.4-xml > /dev/null

# An extension is required!
# We deal with concurrencies over 1k, which stream_select doesn't support.
RUN apt-get install -yqq libuv1-dev > /dev/null \
&& pecl install uv-beta > /dev/null \
&& echo "extension=uv.so" > /etc/php/8.3/cli/conf.d/uv.ini
# libuv
# RUN apt-get install -yqq libuv1-dev > /dev/null \
# && pecl install uv-beta > /dev/null \
# && echo "extension=uv.so" > /etc/php/8.4/cli/conf.d/uv.ini

# libevent
RUN apt-get install -y libevent-dev > /dev/null \
&& pecl install event-3.1.4 > /dev/null \
&& echo "extension=event.so" > /etc/php/8.4/cli/conf.d/event.ini

Comment on lines +13 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely out of interest, why the switch to event from uv?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry !

I test it locally also with libevent, to compare with other frameworks that use it too.
Libuv is only used for Reactphp, not other php frameworks, so we can compare with others.

Also it's good to compare with both event systems and check the faster one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With libevent other PHP frameworks have up to 3,854,134 req/s with the plaintext test.
And Reactphp with libuv have a max of ~70,000 req/s.

So we can check if it's a problem with the event system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry !

Please, no need to be sorry!

With libevent other PHP frameworks have up to 3,854,134 req/s with the plaintext test. And Reactphp with libuv have a max of ~70,000 req/s.

So we can check if it's a problem with the event system.

That be pretty neat! Also, the current set up is fully single process, will have a look at some point at how easy it is to rework it into multi core support.

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

COPY deploy/conf/* /etc/php/8.3/cli/conf.d/
COPY --link deploy/conf/* /etc/php/8.4/cli/conf.d/

WORKDIR /reactphp
COPY --link . .

COPY composer.json .
RUN composer install --prefer-dist --optimize-autoloader --no-dev --quiet

COPY . .
RUN composer install --prefer-dist --optimize-autoloader --no-dev

EXPOSE 8080

Expand Down
Loading