Posts

Showing posts from October, 2017

Building ReactPHP Memached Client

Image
Building ReactPHP Memached Client This is the first article from the series about building from scratch a streaming Memcached PHP client for ReactPHP ecosystem. The library is already released and published, you can find it on  GitHub . Before writing any code we should think about our future client’s API: How we are going to use it. What methods it is going to have. The client is going to be used in ReactPHP asynchronous ecosystem, so I’m going to provide a promise-based interface for it (when methods return promises). Also, we are building a streaming client. Under the hood, we will open a socket connection and use it as a stream. The client itself will be a wrapper on this binary stream communication. That means that it is our job to manually parse Memcached protocol to write and read data with sockets. So, having all of this in mind, let’s start. Client Factory Our client has two dependencies: a stream, which represents a binary socket connection between ...

Symfony 4: HTTP/2 Push and Preloading

Image
Symfony 4: HTTP/2 Push and Preloading A few months ago, I’ve contributed a new component to  Symfony :  WebLink . By implementing cutting edge web standards, namely  HTTP/2 Server Push  and W3C’s  Resource Hints , it brings great opportunities to boost webapp’s performance. Thanks to Symfony WebLink, HTTP/2 ( h2 ) servers are able to push resources to clients before they even know that they need them (think to CSS or JavaScript files, or relations of an API resource). WebLink also enables other very efficient optimisations that work with HTTP 1: telling the browser to fetch or to render another webpage in the background ; init early DNS lookups, TCP handshakes or TLS negotiations Let’s discover how easy it is to use it and the real life benefits you can expect. The WebLink components is available since Symfony 3.3 (it means you can start to use it today), but in this article I’ll use Symfony 4 to celebrate  the release of its first ...