Book Image

Mastering The Faster Web with PHP, MySQL, and JavaScript

By : Andrew Caya
Book Image

Mastering The Faster Web with PHP, MySQL, and JavaScript

By: Andrew Caya

Overview of this book

This book will get you started with the latest benchmarking, profiling and monitoring tools for PHP, MySQL and JavaScript using Docker-based technologies. From optimizing PHP 7 code to learning asynchronous programming, from implementing Modern SQL solutions to discovering Functional JavaScript techniques, this book covers all the latest developments in Faster Web technologies. You will not only learn to determine the best optimization strategies, but also how to implement them. Along the way, you will learn how to profile your PHP scripts with Blackfire.io, monitor your Web applications, measure database performance, optimize SQL queries, explore Functional JavaScript, boost Web server performance in general and optimize applications when there is nothing left to optimize by going beyond performance. After reading this book, you will know how to boost the performance of any Web application and make it part of what has come to be known as the Faster Web.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Foreword
Contributors
Preface
Free Chapter
1
Faster Web – Getting Started
6
Querying a Modern SQL Database Efficiently
Index

Performance testing with Blackfire.io


Before we start, please note that this feature is available only to premium and enterprise users and that, therefore, it requires a paid subscription.

In order to automate performance testing, we will start by creating a very simple blackfire.yml file in our repository. This file will contain our tests. A test should be composed of a name, a regular expression and a set of assertions. It is always preferable to avoid creating volatile time tests as these make for very brittle tests that might yield very different results from one profiling session to the next. Examples of strong performance tests would be to check CPU or memory consumption, number of SQL queries or testing results by profile comparisons. In our case, we will create a very basic and volatile time test just for the sake of giving a short and simple example. Here is the content of our .blackfire.yml file:

tests: 
    "Pages should be fast enough": 
        path: "/.*" # run the assertions...