Mastering The Faster Web with PHP, MySQL, and JavaScript
eBook - ePub

Mastering The Faster Web with PHP, MySQL, and JavaScript

Develop state-of-the-art web applications using the latest web technologies

Andrew Caya

Compartir libro
  1. 278 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Mastering The Faster Web with PHP, MySQL, and JavaScript

Develop state-of-the-art web applications using the latest web technologies

Andrew Caya

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Make web applications run faster by using advanced PHP, SQL and JavaScript techniques

Key Features

  • Use a customized PHP stack to create efficient data-driven web applications
  • Ensure seamless implementation of a JavaScript & HTML 5 CSS based frontend and PHP based backend.
  • Learn about problem identification, best strategies, and UI design patterns as well to build a clean, fast web application

Book Description

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.

What you will learn

  • Install, confgure, and use profling and benchmarking testing tools
  • Understand how to recognize optimizable data structures and functions to effectively optimize a PHP7 application
  • Diagnose bad SQL query performance and discover ways to optimize it
  • Grasp modern SQL techniques to optimize complex SQL queries
  • Identify and simplify overly complex JavaScript code
  • Explore and implement UI design principles that effectively enhance the performance
  • Combine web technologies to boost web server performance

Who this book is for

The audience for this book would be PHP developers who have some basic knowledge of PHP programming and Web technologies. JavaScript programming knowledge is not necessary.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Mastering The Faster Web with PHP, MySQL, and JavaScript un PDF/ePUB en línea?
Sí, puedes acceder a Mastering The Faster Web with PHP, MySQL, and JavaScript de Andrew Caya en formato PDF o ePUB, así como a otros libros populares de Informatique y Développement Web. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2018
ISBN
9781788397711
Edición
1
Categoría
Informatique

Continuous Profiling and Monitoring

In this chapter, we will learn how to install and configure profiling and monitoring tools that will help you easily optimize PHP code in a continuous integration (CI) and a continuous deployment (CD) environment.
We will start by installing and configuring a basic Blackfire.io setup in order to easily and automatically profile code when committing it to a repository. We will also learn how to install a TICK Stack in order to continuously monitor our code's performance after its deployment on a live production server.
Thus, in this chapter, we will cover the following points:
  • Installing and configuring the Blackfire.io agent, client and PHP extension
  • Integrating the Blackfire.io client with Google Chrome
  • Integrating the Blackfire.io client with a known CI tool like Travis
  • Installing and configuring a complete TICK Stack with Grafana

What is Blackfire.io?

As stated on the official Blackfire website (https://blackfire.io), Blackfire empowers all developers and IT/Ops to continuously verify and improve their app's performance, throughout its life cycle, by getting the right information at the right moment. It is, therefore, a performance management solution that allows you to automatically profile your code and set performance standards through assertions throughout your application's life cycle, especially in the development phase. Blackfire.io is a tool that makes what Fabien Potencier calls performance as a feature possible, by making performance tests a part of the development cycle from the very beginning of a project.

Installing and configuring Blackfire.io

Installing and configuring Blackfire.io means setting up three components: the agent, the client and the PHP Probe. In the context of this book, we will be installing Blackfire.io inside our Linux for PHP container. To get more information on installing Blackfire.io on another operating system, please see the following instructions: https://blackfire.io/docs/up-and-running/installation.
We will start by installing the Blackfire agent. On the container's command-line interface, enter the following commands:
# rm /srv/www
# ln -s /srv/fasterweb/chapter_2 /srv/www
# cd /srv/www # wget -O blackfire-agent https://packages.blackfire.io/binaries/blackfire-agent/1.17.0/blackfire-agent-linux_static_amd64
Once the download is completed, you should see the following result:
Blackfire agent download is done
If so, please continue by typing these commands:
# mv blackfire-agent /usr/local/bin/ # chmod +x /usr/local/bin/blackfire-agent 
Now, we will copy a basic agent configuration file to our etc directory:
# mkdir -p /etc/blackfire # cp agent /etc/blackfire/ 
Here is the content of the file we just copied. It is a basic configuration file, as suggested by the Blackfire team:
[blackfire] ; ; setting: ca-cert ; desc : Sets the PEM encoded certificates ; default: ca-cert= ; ; setting: collector ; desc : Sets the URL of Blackfire's data collector ; default: https://blackfire.io collector=https://blackfire.io/ ; ; setting: log-file ; desc : Sets the path of the log file. Use stderr to log to stderr ; default: stderr log-file=stderr ; ; setting: log-level ; desc : log verbosity level (4: debug, 3: info, 2: warning, 1: error) ; default: 1 log-level=1 ; ; setting: server-id ; desc : Sets the server id used to authenticate with Blackfire API ; default: server-id= ; ; setting: server-token ; desc : Sets the server token used to authenticate with Blackfire API. It is unsafe to set this from the command line ; default: server-token= ; ; setting: socket ; desc : Sets the socket the agent should read traces from. Possible value can be a unix socket or a TCP address ; default: unix:///var/run/blackfire/agent.sock on Linux, unix:///usr/local/var/run/blackfire-agent.sock on MacOSX, and tcp://127.0.0.1:8307 on Windows. socket=unix:///var/run/blackfire/agent.sock ; ; setting: spec ; desc : Sets the path to the json specifications file ; default: spec= 
Then, create an empty file that will be used as the agent's socket:
# mkdir -p /var/run/blackfire # touch /var/run/blackfire/agent.sock 
Finally, we will register our agent with the Blackfire service:
# blackfire-agent -register 
Once you will have entered the last command, you will have to supply your Blackfire server credentials. These can be found in your Blackfire account at: https://blackfire.io/account#server. Once you have entered your credentials, you can start the agent by entering the following command:
# blackfire-agent start & 
After starting the agent, you should see the agent's PID number. This tells you that the agent is listening on the default UNIX socket that we created previously. In this example, the agent has a PID number of eight (8):
Blackfire agent process ID number is displayed
Once the agent is installed and configured, you can install the Blackfire client. We will install and configure the client by issuing the following commands. Let's start by downloading the binary:
# wget -O blackfire https://packages.blackfire.io/binaries/blackfire-agent/1.17.0/blackfire-cli-linux_static_amd64 
After the download is done, you should see the following message:
Blackfire client download is done
You can now proceed to configure the client. Enter the following commands:
# mv blackfire /usr/local/bin/ # chmod +x /usr/local/bin/blackfire # blackfire config 
After entering the final command, you will have to supply your Blackfire client credentials. These can also be found in your Blackfire account at the following URL: https://blackfire.io/account#client.
The final step in order to run Blackfire.io on our server is to install the Blackfire Probe as a PHP extension. In order to do this, please start by downloading the library:
# wget -O blackfire.so https://packages.blackfire.io/binaries/blackfire-php/1.20.0/blackfire-php-linux_amd64-php-71.so
Once the download is completed, you should get this confirmation message:
Blackfire probe download is done
You can then copy the shared library file into your PHP extensions directory. If you...

Índice