Skip to content
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

Default dtrace support #813

Open
axot opened this issue Apr 12, 2019 · 6 comments · May be fixed by #1367
Open

Default dtrace support #813

axot opened this issue Apr 12, 2019 · 6 comments · May be fixed by #1367
Labels
question Usability question, not directly related to an error with the image Request Request for image modification or feature

Comments

@axot
Copy link

axot commented Apr 12, 2019

I'm considering is there any reason why dtrace was disabled by default?

@tianon
Copy link
Member

tianon commented Apr 12, 2019

We considered it for python over in docker-library/python#366 (:wave: @tgross!), but after doing performance testing it was found to have an unfortunately negative effect.

Perhaps something similar could be done here to verify the impact? (Also worth checking whether a packager like Debian includes this, but they likely don't currently.)

@wglambert wglambert added question Usability question, not directly related to an error with the image Request Request for image modification or feature labels Apr 15, 2019
@axot
Copy link
Author

axot commented Apr 19, 2019

I did a simple benchmark which enables/disables dtrace at build time, the result shows there is no significant difference.

$ git diff
diff --git i/7.2/stretch/cli/Dockerfile w/7.2/stretch/cli/Dockerfile
index b229a2d..f607223 100644
--- i/7.2/stretch/cli/Dockerfile
+++ w/7.2/stretch/cli/Dockerfile
@@ -26,7 +26,8 @@ ENV PHPIZE_DEPS \
                libc-dev \
                make \
                pkg-config \
-               re2c
+               re2c \
+               systemtap-sdt-dev

 # persistent / runtime deps
 RUN apt-get update && apt-get install -y \
@@ -95,7 +96,7 @@ RUN set -xe; \
                wget -O php.tar.xz.asc "$PHP_ASC_URL"; \
                export GNUPGHOME="$(mktemp -d)"; \
                for key in $GPG_KEYS; do \
-                       gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
+                       gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$key"; \
                done; \
                gpg --batch --verify php.tar.xz.asc php.tar.xz; \
                command -v gpgconf > /dev/null && gpgconf --kill all; \
@@ -150,6 +151,7 @@ RUN set -eux; \
                ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
        fi; \
        ./configure \
+               --enable-dtrace \
                --build="$gnuArch" \
                --with-config-file-path="$PHP_INI_DIR" \
                --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \

The results,

WIth --enable-dtrace

root@6c3b47d93ee5:/usr/local/include/php# php -n Zend/bench.php
simple             0.054
simplecall         0.010
simpleucall        0.020
simpleudcall       0.020
mandel             0.166
mandel2            0.172
ackermann(7)       0.031
ary(50000)         0.006
ary2(50000)        0.005
ary3(2000)         0.043
fibo(30)           0.084
hash1(50000)       0.013
hash2(500)         0.010
heapsort(20000)    0.032
matrix(20)         0.030
nestedloop(12)     0.090
sieve(30)          0.016
strcat(200000)     0.006
------------------------
Total              0.806

root@6c3b47d93ee5:/usr/local/include/php# USE_ZEND_DTRACE=1  php -n Zend/bench.php
simple             0.053
simplecall         0.009
simpleucall        0.025
simpleudcall       0.027
mandel             0.164
mandel2            0.172
ackermann(7)       0.042
ary(50000)         0.004
ary2(50000)        0.003
ary3(2000)         0.046
fibo(30)           0.115
hash1(50000)       0.015
hash2(500)         0.014
heapsort(20000)    0.036
matrix(20)         0.034
nestedloop(12)     0.096
sieve(30)          0.019
strcat(200000)     0.007
------------------------
Total              0.883

Without --enable-dtrace

root@4e09afa52cb4:/usr/local/include/php# php Zend/bench.php
simple             0.054
simplecall         0.008
simpleucall        0.020
simpleudcall       0.020
mandel             0.174
mandel2            0.171
ackermann(7)       0.030
ary(50000)         0.004
ary2(50000)        0.005
ary3(2000)         0.042
fibo(30)           0.080
hash1(50000)       0.012
hash2(500)         0.009
heapsort(20000)    0.031
matrix(20)         0.030
nestedloop(12)     0.089
sieve(30)          0.015
strcat(200000)     0.006
------------------------
Total              0.801

root@4e09afa52cb4:/usr/local/include/php# USE_ZEND_DTRACE=1  php -n Zend/bench.php
simple             0.053
simplecall         0.008
simpleucall        0.019
simpleudcall       0.022
mandel             0.173
mandel2            0.173
ackermann(7)       0.029
ary(50000)         0.004
ary2(50000)        0.003
ary3(2000)         0.041
fibo(30)           0.081
hash1(50000)       0.014
hash2(500)         0.012
heapsort(20000)    0.031
matrix(20)         0.029
nestedloop(12)     0.089
sieve(30)          0.016
strcat(200000)     0.005
------------------------
Total              0.804

@tianon
Copy link
Member

tianon commented Apr 19, 2019

Ah, interesting! Unlike python, PHP threw this functionality behind a feature flag environment variable to help insulate against the performance overhead; neat!

Looks like that was added back in 7.1.0:

- DTrace:
  . Disabled PHP call tracing by default (it makes significant overhead).
    This may be enabled again using envirionment variable USE_ZEND_DTRACE=1.
    (Dmitry)

So the impact is significant, but still optional. I will note though that I have been looking for a better PHP benchmark than Zend/bench.php (I used it a lot to try and chase down #493 and/or #753) as I found it to be horribly insufficient to get a real decent view of PHP's performance (so the fact that it's noticeable even there is an indicator of likely a much larger impact elsewhere).

@axot
Copy link
Author

axot commented Apr 25, 2019

I remember PHP internal did some benchmark for older PHP, like this one,
http://languagesperformance.intel.com/good-benchmark-results-for-php-master-2017-09-10/

NIGHTLY BUILDS: ZEND PHP ENVIRONMENT SETUP,
https://01.org/node/3774

@nawarian
Copy link

Hey people; I ended up here after some research and would like to bring up the topic again, as the issue is not yet resolved.
Are there any plans on enabling dtrace by default?
Does it make sense to submit a Pull Request? (Maybe @axot could do it if time fits, as the diff was already provided)

@tianon
Copy link
Member

tianon commented Feb 14, 2020

I think it needs someone to set up a better benchmark than Zend/bench.php (more thorough and/or more realistic) and verify that the opt-out performance is still reasonable on a heavier or more real workload.

https://01.org/node/3774 looks very promising, but rather involved.

@tianon tianon linked a pull request Feb 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image Request Request for image modification or feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants