Inhaltsverzeichnis
Why Windows-PHP team used Profile Guided Optimization (PGO)?
What are the 'key steps' performed by the Windows PHP team for PGO'izing Windows PHP binaries?    
What were the 'key challenges' faced by the Windows PHP team while PGO'izing Windows PHP binaries?
What are the performance gains received by the Windows PHP team by PGO'izing their binaries?
Wrap up" >Wrap up
Heim php教程 php手册 Speed up Windows PHP Performance using Profile Gui

Speed up Windows PHP Performance using Profile Gui

Jun 06, 2016 pm 08:09 PM
performance php speed windows

To introduce myself I am Ankit Asthana and I am the program manager for the backend C++ compiler. In my last two blogs I provided an introduction to what Profile Guided Optimization (PGO) is all about and a case study which illustrates how

To introduce myself I am Ankit Asthana and I am the program manager for the backend C++ compiler. In my last two blogs I provided an introduction to what Profile Guided Optimization (PGO) is all about and a case study which illustrates how PGO is used to make SAP NetWeaver faster.  In this blog I would like to present the story about how PGO is used make official Windows PHP binaries faster. Stephen Zarkos (Program Manager for Windows PHP) has been kind enough for providing the content for this blog.

 After reading this blog you folks should be able to further understand and use this case study to introduce PGO for your applications. In addition to this, for experienced PHP users, this blog post should serve as an optimization opportunity to further optimize Windows PHP performance for their specific workloads. So let's get started!

As most of you probably already know PHP is a server side scripting language designed for web development but also used as a general purpose programming language. PHP is heavily used today and it powers millions of websites and webservers. In addition to this PHP is also used to power a plethora of open source content management system (CMS) such as Joomla, WordPress and Drupal.

The effort to PGO'ize the Windows PHP binaries was led by Microsoft Open Source Technology (OSTC) group. OSTC's primary goal is to work with open-source communities to help their software interoperate with or run better on Windows Server and Windows Azure. To be precise, this is not the only group at Microsoft that works with open source but amazingly these days is only one of many. A few examples of projects this group works on are PHP on Windows, Openstack with Hyper-V, CoApp (coapp.org) and the Linux Integration Services for Hyper-V and Azure.     

Why Windows-PHP team used Profile Guided Optimization (PGO)?

Over the past several years, Microsoft and its partners have worked diligently with the PHP community to improve the experience PHP developers and users have on Windows Server and Windows Azure. As a result newer versions of PHP (i.e. PHP 5.4) for Windows include dramatic improvements that come from a deep collaboration between the PHP Core Maintainers and Microsoft. One factor attributing to a faster Windows PHP 5.4 and 5.5 is Profile Guided Optimization (PGO). The overall goal with this collaboration is to improve PHP on Windows and enable Windows specific capabilities in a way that provides PHP users the same (or better, if possible) capabilities that they see on other platforms.

After having tested the water with using PGO for Windows PHP 5.3, the team was finally able to incorporate PGO for Windows PHP 5.4. Performance is a primary goal for the Windows PHP team which served as the key reason behind PGO'izing the PHP binaries on Windows. PGO provided an important opportunity to optimize the performance of the PHP interpreter without changing any functional behavior. 

What are the 'key steps' performed by the Windows PHP team for PGO'izing Windows PHP binaries?    

Revisiting my previous blogs, there are essentially three steps required in PGO'izing an application (Instrument, Train and Optimize). Remember the 'Instrument' and 'Optimize' steps require an 'LTCG:PGINSTRUMENT' and 'LTCG:PGOPTIMIZE' build respectively (for more information please take a look at my last blog post).

The steps to PGO'ize Windows PHP binaries are essentially in-line with PGO'izing any generic application and are as follows:

  • Creating an Instrumented build of Windows PHP binaries (i.e. the Instrumentation Phase)

    For those of you who would like to get some firsthand experience in doing this, creating an instrumented version of the Windows PHP binaries requires user to pass the additional '--enable-pgi' parameter to the PHP configure script. After running the configure script just rebuild with 'nmake snap'. For more detailed instructions on how to set this up take a look at this blog post.
     
  • Collecting Training Data (i.e. the Train Phase)

    This step can be as simple as setting up PHP with IIS or Apache with your PHP application and then accessing the application via a web-browser. A good training session should exercise workflows that your users will hit most often. The Windows PHP team currently trains by having a number of PHP applications preconfigured, for both IIS and Apache (on Windows) and then exercising these applications via requesting specific pages (usually several times for the most used pages) in order to get wide coverage. As of today, the Windows PHP team trains with every snapshot and release build of PHP binaries.

    Snapshot builds can happen multiple times a day (depending on the number of commits on that particular day).  Every snapshot for PHP 5.4, 5.5 and the Master branch is automated where the build automation goes through the process of creating the instrumented binary, setting up IIS and Apache, running through a series of applications to produce the training data, copying those back to the PHP build directory and then finally rebuilding the optimized PHP.

    The end result of the training phase is the "*.pgc" files which are essentially training data files that contain all the information required by the 'Optimize phase'. You need to copy these files back into your PHP build directory for the next phase of the build.
     
  • Building optimized Windows PHP binaries (i.e. the Optimize Phase)

    A user can build an optimized version of PHP binaries following the simple steps listed below:
    a. Copy the *.pgc files back to your PHP build directory
    b. Run the command "nmake --clean-pgo" to clean your build directory (but not the .pgc files)
    c. Re-run the configure script, but remove the "--enable-pgi" parameter and instead add the "--with-pgo" parameter
    d. Run "nmake" and then "nmake snap" to build the final optimized PHP

This entire process can take several hours, depending upon the speed of your build machine. For best results (i.e higher build throughput and maximum PGO performance gains), use Visual Studio 2012 RTM. 

What were the 'key challenges' faced by the Windows PHP team while PGO'izing Windows PHP binaries?

The work for PGO'izing PHP began as a proof of concept exercise. The Windows PHP team did some work several years ago to test PGO and see how they can leverage it for PHP. This exercise was useful in finding the following few key challenges which the team addressed when enabling PGO for PHP 5.4:

  • How to train the PHP binaries: At first it was difficult for the Windows PHP team to understand how best to train the PHP Windows binaries. In particular, 'what training scenarios to run?', 'how long to train for?' and 'what kind of applications to train with?'
     
  • Absorbing longer build times: To save man hours, every part of the 'Windows PHP PGO build process was automated. Adding PGO to the build process was a fairly easy exercise, but the main challenge here was to deal with the additional build times required. Given the Windows PHP has various builds (thread-safe, non-thread, and now x86 & x64 for PHP 5.5) to absorb the additional build times they needed to add more/faster build systems, and improve their build automation to support concurrent builds.
     
  • Additional quality assurance required: Validating the effectiveness of your PGO training scenario is essential and plays a major part in obtaining maximum performance gains. Good testing is still the key to the success of PGO in PHP.  At the time PHP 5.4 was released the Windows PHP team had pretty good test automation and hence were able to identify issues where using PGO changed the behavior of PHP.  These issues observed were then mitigated by the use of #pragma statements.

What are the performance gains received by the Windows PHP team by PGO'izing their binaries?

For testing PHP performance, applications such as Drupal, Mediawiki, Wordpress and Joomla are deployed on IIS and Apache webservers. These applications are then stressed using load agents and various metrics such as transactions per second (TPS) are recorded and reported. To better demonstrate the performance improvements we can see with PGO, the 'TPS' for these applications with/without PGO'ized PHP binaries is listed in the table below:           

             

                               Table 1: Performance gain for applications leveraging PGO'ized Windows PHP 5.5

As you can see some of these results are pretty impressive! A detailed summary of these results which includes some of the gritty details used to generate these results can be found here.

Wrap up

Although Profile Guided Optimization (PGO) is a complex technology, I hope this blog provides you further evidence on the usefulness of PGO and does a fair job in explaining how the Windows PHP team PGO'ized the Windows PHP binaries. In my future blogs I will go over how PGO works under the hood to provide the performance gains enjoyed by a plethora of products out there.

So stay tuned! Additionally, if you would like us to blog about some other PGO-related scenarios or are just curios and have a few more questions about PGO please feel free to reach out to me. I will do my best to answer them.

Speed up Windows PHP Performance using Profile Gui
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

AI Hentai Generator

AI Hentai Generator

Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)
4 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
4 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können
4 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: Wie man alles in Myrise freischaltet
1 Monate vor By 尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Erklären Sie JSON Web Tokens (JWT) und ihren Anwendungsfall in PHP -APIs. Erklären Sie JSON Web Tokens (JWT) und ihren Anwendungsfall in PHP -APIs. Apr 05, 2025 am 12:04 AM

JWT ist ein offener Standard, der auf JSON basiert und zur sicheren Übertragung von Informationen zwischen Parteien verwendet wird, hauptsächlich für die Identitätsauthentifizierung und den Informationsaustausch. 1. JWT besteht aus drei Teilen: Header, Nutzlast und Signatur. 2. Das Arbeitsprinzip von JWT enthält drei Schritte: Generierung von JWT, Überprüfung von JWT und Parsingnayload. 3. Bei Verwendung von JWT zur Authentifizierung in PHP kann JWT generiert und überprüft werden, und die Funktionen und Berechtigungsinformationen der Benutzer können in die erweiterte Verwendung aufgenommen werden. 4. Häufige Fehler sind Signaturüberprüfungsfehler, Token -Ablauf und übergroße Nutzlast. Zu Debugging -Fähigkeiten gehört die Verwendung von Debugging -Tools und Protokollierung. 5. Leistungsoptimierung und Best Practices umfassen die Verwendung geeigneter Signaturalgorithmen, das Einstellen von Gültigkeitsperioden angemessen.

Erklären Sie den Match -Expression (Php 8) und wie er sich vom Schalter unterscheidet. Erklären Sie den Match -Expression (Php 8) und wie er sich vom Schalter unterscheidet. Apr 06, 2025 am 12:03 AM

In PHP8 sind Übereinstimmungsausdrücke eine neue Kontrollstruktur, die unterschiedliche Ergebnisse basierend auf dem Wert des Expression zurückgibt. 1) Es ähnelt einer Switch -Anweisung, gibt jedoch einen Wert anstelle eines Ausführungsanweisungsblocks zurück. 2) Der Match -Ausdruck wird streng verglichen (===), was die Sicherheit verbessert. 3) Es vermeidet mögliche Auslassungen in Switch -Anweisungen und verbessert die Einfachheit und Lesbarkeit des Codes.

Kann ich MySQL unter Windows 7 installieren? Kann ich MySQL unter Windows 7 installieren? Apr 08, 2025 pm 03:21 PM

Ja, MySQL kann unter Windows 7 installiert werden, und obwohl Microsoft Windows 7 nicht mehr unterstützt hat, ist MySQL dennoch kompatibel damit. Während des Installationsprozesses sollten jedoch folgende Punkte festgestellt werden: Laden Sie das MySQL -Installationsprogramm für Windows herunter. Wählen Sie die entsprechende Version von MySQL (Community oder Enterprise) aus. Wählen Sie während des Installationsprozesses das entsprechende Installationsverzeichnis und das Zeichen fest. Stellen Sie das Stammbenutzerkennwort ein und behalten Sie es ordnungsgemäß. Stellen Sie zum Testen eine Verbindung zur Datenbank her. Beachten Sie die Kompatibilitäts- und Sicherheitsprobleme unter Windows 7, und es wird empfohlen, auf ein unterstütztes Betriebssystem zu aktualisieren.

Was ist Cross-Site-Anforderungsfälschung (CSRF) und wie implementieren Sie den CSRF-Schutz in PHP? Was ist Cross-Site-Anforderungsfälschung (CSRF) und wie implementieren Sie den CSRF-Schutz in PHP? Apr 07, 2025 am 12:02 AM

In PHP können Sie CSRF -Angriffe effektiv verhindern, indem Sie unvorhersehbare Token verwenden. Spezifische Methoden umfassen: 1. CSRF -Token in der Form erzeugen und einbetten; 2. Überprüfen Sie die Gültigkeit des Tokens bei der Bearbeitung der Anfrage.

Wie können Sie verhindern, dass eine Klasse erweitert wird oder eine Methode in PHP überschrieben wird? (endgültiges Schlüsselwort) Wie können Sie verhindern, dass eine Klasse erweitert wird oder eine Methode in PHP überschrieben wird? (endgültiges Schlüsselwort) Apr 08, 2025 am 12:03 AM

In PHP wird das endgültige Schlüsselwort verwendet, um zu verhindern, dass Klassen vererbt werden, und die Methoden überschrieben werden. 1) Wenn die Klasse als endgültig markiert wird, kann die Klasse nicht vererbt werden. 2) Wenn die Methode als endgültig markiert wird, kann die Methode nicht von der Unterklasse neu geschrieben werden. Durch die Verwendung von endgültigen Schlüsselwörtern wird die Stabilität und Sicherheit Ihres Codes sichergestellt.

Wie beschleunigt man die Ladegeschwindigkeit von PS? Wie beschleunigt man die Ladegeschwindigkeit von PS? Apr 06, 2025 pm 06:27 PM

Das Lösen des Problems des langsamen Photoshop-Startups erfordert einen mehrstufigen Ansatz, einschließlich: Upgrade-Hardware (Speicher, Solid-State-Laufwerk, CPU); Deinstallieren veraltete oder inkompatible Plug-Ins; Reinigen des Systemmülls und übermäßiger Hintergrundprogramme regelmäßig; irrelevante Programme mit Vorsicht schließen; Vermeiden Sie das Öffnen einer großen Anzahl von Dateien während des Starts.

Erklären Sie strenge Typen (deklar (strict_types = 1);) in PHP. Erklären Sie strenge Typen (deklar (strict_types = 1);) in PHP. Apr 07, 2025 am 12:05 AM

Strenge Typen in PHP werden durch Hinzufügen von Declare aktiviert (strict_types = 1); oben in der Datei. 1) IT erzwingt die Typprüfung der Funktionsparameter und der Rückgabewerte, um die implizite Typumwandlung zu verhindern. 2) Die Verwendung strenger Typen kann die Zuverlässigkeit und Vorhersehbarkeit des Codes verbessern, Fehler reduzieren und die Wartbarkeit und Lesbarkeit verbessern.

See all articles