Join the community today
Become a Member

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

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 PM
  2. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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 :)
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    more at High Performance PHP 7 | Intel® Software and interesting
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 PM
  8. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  10. ethanpil

    ethanpil Active Member

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    8:20 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

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    we'll see :D
     
  17. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  18. eva2000

    eva2000 Administrator Staff Member

    54,919
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:20 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+