Discover Centmin Mod today
Register Now

PHP Build PHP with Profile-Guided Optimization for 7% speed increase?

Discussion in 'Nginx and PHP-FPM news & discussions' started by ethanpil, Oct 1, 2016.

  1. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
    • Informative Informative x 1
  2. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    Nice will have to see if this can be applied to Centmin Mod source compiles :)
    this part would be hard to do when no sites are setup yet though ! but make for php recompiles

    more info PHP 7 Performance Improvements May Increase if You Optimize it to Your Application using to PGO - PHP Classes

     
    Last edited: Oct 1, 2016
  3. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
    Yes, I think simple it would be a 3 step process.

    1) Compile PHP with instrumentation.
    2) Centminmod server admin will access the websites pages and use common functions of the site to build profile.
    3) Recompile php using the generated profile

    I also think if we have many wordpress sites it would be good to automate the entire process.

    1) Install a test domain with basic wordpress
    2) Compile PHP with instrumentation.
    3) use curl to access front and backend pages of test domain
    4) Recompile php using the generated profile
    5) delete demo domain and DB
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    might be easier if i can find out if make prof-gen survives subsequent php recompiles (i.e. make clean) as i could make it so initial first time php install compile uses make prof-gen, then let users run that php version for their sites and next time they recompile (not upgrade) the same php version via centmin.sh menu option 5, use make prof-use so it would be optimised for all sorts of already php requests/processing done.

    Will see :)
     
    • Winner Winner x 1
  5. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    more at High Performance PHP 7 | Intel® Software and interesting
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    hmm doesn't seem to work for make prof-gen on PHP 5.6.26 so maybe PHP 7 only ?
    Code (Text):
    make prof-gen     
    make: *** No rule to make target `prof-gen'.  Stop.
     
  7. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
  8. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    will test on PHP 7 and see

    found something useful GitHub - 01org/php_pgo_training_scripts

    Code (Text):
    * Authors:
    *   Gabriel Samoila <gabriel.c.samoila@intel.com>
    *   Bogdan Andone <bogdan.andone@intel.com>


    seems to suggest PHP 7 only !
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
  10. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
    I don't see in your guide how to differentiate between first and second compile. Also how can we recompile after significant changes to PHP codebase?
     
  11. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    It's all done in the same centmin.sh menu option 5 php recompile run for 1st and 2nd compilations using Intel provided training profiles for wordpress, drupal and mediawiki like PHP execution patterns GitHub - 01org/php_pgo_training_scripts
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    I guess I could add options for users define additional php script paths to call against too. Or do it automatically just for the web root of each nginx vhost i.e. /home/nginx/domains/domain.com/public/index.php if index.php exists
     
  13. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
    FYI, if you look at the notes for the training profiles, they said its not as good as actual real world training.
     
  14. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    Hmmm. Seems from reading though it's better to use Intel provided PGO training scripts if you have more than one PHP web application on server that directing php to train against just Wordpress :) If you only had Wordpress and no other PHP scripts, then training aginst real Wordpress path would be optimal.
     
  15. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    1:38 PM
    Should be an option to self train or not. For example, my servers 90% wordpress. Would prefer to squeeze an extra 3-4%! :)
     
  16. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    we'll see :D
     
    • Like Like x 1
  17. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
  18. eva2000

    eva2000 Administrator Staff Member

    30,157
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    1:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Winner Winner x 1