O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mastering The Faster Web with PHP, MySQL, and JavaScript

Book Description

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

About This Book
  • 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
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.

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
In Detail

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.

Style and approach

The book has a step by step practical approach to developing highly efficient Web applications, with many practical and useful code snippets.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Mastering The Faster Web with PHP, MySQL, and JavaScript
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Foreword
  6. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  8. Faster Web – Getting Started
    1. What is the Faster Web?
      1. The Faster Web and performance
      2. Measuring the Faster Web
        1. Before Measuring
        2. Benchmark testing and profiling
          1. Practical prerequisites
          2. Understanding Apache Bench (AB)
          3. Understanding Siege
      3. Installing and configuring useful tools
        1. Profiling PHP – xdebug Installation and Configuration
        2. SQL – Speed Testing
        3. JavaScript – Developer Tools
    2. Summary
    3. References
  9. Continuous Profiling and Monitoring
    1. What is Blackfire.io?
      1. Installing and configuring Blackfire.io
      2. Profiling manually with Blackfire.io
    2. Performance testing with Blackfire.io
    3. Monitoring performance with the TICK Stack
    4. Summary
    5. References
  10. Harnessing the Power of PHP 7 Data Structures and Functions
    1. PHP 7 optimizations
      1. Strict typing
      2. Immutable and packed arrays
      3. Memory allocation of integers and floats
      4. String interpolation and concatenation
      5. Parameter references
    2. Identifying more possible optimizations
    3. Functional programming and memoization
    4. Summary
    5. Reference
  11. Envisioning the Future with Asynchronous PHP
    1. Asynchronous non-blocking I/O calls
    2. Multithreading with pthreads
    3. Using the ReactPHP library
    4. Summary
  12. Measuring and Optimizing Database Performance
    1. SQL query performance
      1. The structure of indexes
      2. The execution plan
      3. Basic query optimization
      4. The performance schema and advanced query optimization
    2. Advanced benchmarking tools
      1. DBT2
      2. SysBench
    3. Summary
  13. Querying a Modern SQL Database Efficiently
    1. Modern SQL
      1. Definition
        1. WITH and WITH RECURSIVE
        2. CASE
        3. OVER and PARTITION BY
        4. OVER AND ORDER BY
        5. GROUPING SETS
        6. JSON clauses and functions
        7. FILTER
        8. LATERAL queries
    2. Summary
  14. JavaScript and Danger-Driven Development
    1. The global object and local variables
      1. Avoiding global variables
      2. Evaluating local variables
    2. Avoiding bad idioms and keeping an eye on the very bad parts
      1. Bad idioms
      2. Bad constructs – the with statement
      3. Bad constructs – the eval statement
      4. Bad constructs – the try-catch-finally construct
      5. Avoiding inefficient loops
      6. Linters and strict mode
    3. Using the DOM efficiently
      1. Modifying the document tree
      2. Updating an invisible element
      3. Making style changes
      4. Searching for nodes
      5. Inspecting a large number of nodes
      6. Managing references from one document to another
      7. Caching DOM values
    4. Structuring and loading a JavaScript application
      1. Minimizing costly operations
      2. Cleaning up, minifying, and compressing resources
      3. Loading page resources
      4. Caching page resources
    5. Summary
  15. Functional JavaScript
    1. Simplifying functions
      1. Functional programming principles
      2. Functions as first-class citizens
      3. Dealing with side effects
      4. Immutability
    2. Functional programming techniques
      1. Map
      2. Filter
      3. Reduce
      4. Tail-call optimization
        1. What is TCO?
        2. How TCO works
        3. Recognizing tail-calls
    3. More upcoming JavaScript features
      1. Async functions
      2. Async generators and for-await-of loops
      3. Pipeline operator
      4. Partial application
    4. Summary
  16. Boosting a Web Server's Performance
    1. MOD_SPDY and HTTP/2
      1. Multiplexed and prioritized streams
      2. Server pushing
      3. Header compression
      4. HTTP/2
    2. PHP-FPM and OPCache
      1. PHP-FPM
      2. Zend OPcache
    3. ESI and Varnish Cache
      1. Edge Side Includes (ESI)
      2. Varnish Cache
    4. Client-side caching
      1. Browser caching
      2. Content Delivery Networks (CDNs)
    5. Other Faster Web tools
    6. Summary
    7. References
  17. Going Beyond Performance
    1. Clocked and perceived time
    2. Speed perception
    3. Reasonable delay and response times
    4. UI design principles and patterns
    5. "Beyond Performance" tools
    6. Summary
    7. References
  18. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think