Quantcast
Channel: php – ma.ttias.be
Viewing all articles
Browse latest Browse all 69

The Next-Generation PHP Server Stack For 2015

$
0
0

The post The Next-Generation PHP Server Stack For 2015 appeared first on ma.ttias.be.

The server stack surrounding PHP hasn't change much in the last few years. It's still roughly the same as every year, give or take a few minor tweaks here and there. But 2015 may be the year where some of these services get swapped out for new, improved, ones. Only time will tell of course, but here's my take on the PHP server stack for 2015 (and hopefully, later).

Varnish

For just about every project (obviously not limited to PHP), Varnish is a standard part in the setup. In 2015, Varnish 4.0 will be the new standard, where it's currently mostly Varnish 3.x.

Varnish will continue to serve its purpose running on port :80 of your server, ready to handle the bulk of the load. If you can avoid hitting PHP and the database, you should -- no matter how fast PHP parsing is about to become.

Apache or Nginx

The webserver will still be either Nginx or Apache, depending on the experience of the sysadmin with either of the webservers, or the requirements for the project. The webserver itself will be configured to be as "dumb" as possible: serve static files, perform compression and send the request to the PHP service for further processing.

The days of mod_php and slow FastCGI/CGI scripts are far gone.

SSL termination via proxies

In order to fully utilise the Varnish cache, all requests need to pass by it. But SSL requests are terminated on port :443, and Varnish is unable to perform SSL. Depending on the webserver of your choice, Apache or Nginx, it'll be set up to act as a SSL proxy.

All requests that come in via HTTPs are passed via the proxy, that only does the SSL termination / encryption, and passes the request on to Varnish on port :80. Once in Varnish, it'll either serve a page from cache or forward the request to the real virtual host running on another port.

The benefit of having the Varnish cache, together with SSL encryption for your project.

PHP-FPM or HHVM

While Facebook's HHVM is faster than PHP-FPM today, the new php-ng may be able to change that. The speed results of php-ng do vary, but it's rumoured that at release, it should be at least as fast as HHVM. What's now known as php-ng will most likely become PHP 7, and I'm hopeful to see it released in 2015.

Next up: code compatibility, as a next major version can perform backwards incompatible code breaks. Code written today will probably not work on PHP 7.

Right now, for raw performance it needs to be HHVM. But PHP-FPM has its merits as well, with flexible configs, multiple pools supported and decent performance in the 5.5 version and later. For most setups, PHP 5.5 or 5.6 running as PHP-FPM will be the default, and it will suffice. For those projects that need more performance, HHVM should be consider, until php-ng is released.

PHP-FPM or HHVM will run as Unix socket on the local box, or on a TCP/IP port when it's run on a remote system, and will receive all requests from the webserver that it couldn't handle.

MariaDB and MongoDB

Most have replaced their beloved MySQL with MariaDB for a few years now. In those years, MariaDB 5.5 was considered the standard, but 2015 will be the year where MariaDB 10.0 will see greater adoption. We'll still see MySQL server as well, but it's in the decline: MariaDB is taking over as default RDMS on most Unix distros since the Oracle license change to MySQL, and we should embrace the choice. MariaDB has replaced MySQL.

In the PHP community, MongoDB appears to clear winner in the key/value and document datastore. There's plenty of (worthy) alternatives, but 2015 will still favor MongoDB over those others.

The post The Next-Generation PHP Server Stack For 2015 appeared first on ma.ttias.be.


Viewing all articles
Browse latest Browse all 69

Trending Articles