php-amqplib vs PHP AMQP Extension

##The Problem While testing Futureproofs API performance using BlackFire I noticed that we had a bottleneck centred around an fgets method. It wasn't part of our code (vague I know, I've lost the reference). After a bit of digging I found the culprit in the php-amqlib library; a library we use quite extensively from our API to add messages to RabbitMQ. Now php-amqlib is a great library, we've used it a lot and its never once let us down. »

New Relic London Summit 2016

This year I was fortunate enough to attend New Relics London based summit. Not quite as prestigious as its Futurestack15 San Francisco event, it was non the less, worthwhile. The mission statement, if it were to be summarised would read something along the lines of: We're New Relic; we do stuff with data and here are some of our customers to wax lyrical. And that's not a criticism, the event was on-par or better than most conferences I've been too in recent years. »

If you haven't already: lets encrypt

Unless your new to the industry or you've had your head in the sand you've probably heard about how important SSL certificates are. Not just because of nasty hackers, but nasty governments as well (I'll refrain from ranting). You probably know this and you have probably drawn the line when it comes to actually implementing an SSL certificate. Why? If your like me it's because your frugal and your blog doesn't make money (SSL certificates generally cost money). »

HTML5 Clipboard API plaintext and formatting

A few months ago I was tasked with creating a copy/paste facility within the FP webapp. It worked (across a subset of browsers) but it didn't copy formatting. Improving it wasn't a priority until recently when a colleague of mine was tasked with improving the functionality. It turns out the fix was really quite simple. I'd been copying the content into a textarea and since textareas only contain plaintext, thats what was being copied to the clipboard. »

PHP and Upstart

Up until recently I'd been using cron jobs to “kickstart” any failed/exited rabbitMQ consumers. It works, but didn't come without its own problems, for example: Cron jobs can be no more granular than 1 minute intervals, so if a cron fails, its could take up-to a minute to restart. There is no simple way to terminate/start or restart a process. So I did a bit of googling, I wanted something similar to forever. »

SSH Tunneling and AutoSSH

We recently integrated a search facility into Futureproofs and like some of our previous stack decided to use for our ElasticSearch stack. at the time had 2 ways to connect to the ElasticSearch instance, either whitelist your IP addresses or setup an SSH Tunnel. We weren't in a position to whitelist IP addresses as we dynamically spin up boxes behind a load balancer (no static IPs here), so had no choice but to follow the white rabbit. »

Package 'build-essential' has no installation candidate

While writing some packer scripts recently to build an EC2 AMI (Ubuntu 14.04 x64), I was intermittently getting the following error: amazon-ebs: Package build-essential is not available, but is referred to by another package. amazon-ebs: This may mean that the package is missing, has been obsoleted, or amazon-ebs: is only available from another source amazon-ebs: amazon-ebs: E: Package 'build-essential' has no installation candidate Because it was intermittent I struggled to find a solution; all the posts online suggested I should run apt-get update (or variants) or that I should change the /etc/apt/sources. »

Ben Squire

PHP & RabbitMQ Consumer 101 - Part 1

Over at FutureProofs we are in the process of converting one of our existing PDF intensive operations into a process which is triggered by a RabbitMQ consumer. RabbitMQ for those uninitialised is, put simply, a queueing system. You push “messages” onto it and then build consumers to take messages off again. Why would you do this? Why not have a cron job run these? Or simply trigger a process and let the user wait until it finishes? »

Using Siege to Benchmark API endpoints

Siege is a really useful command line tool for *nix based systems that “is an http load testing and benchmarking utility”. While its not something your likely to use for mass performance testing it is good for quickly testing specific http endpoints. While optimising some secured API enpoints recently it became very labourious trying to build out command line arguments that reflect normal browser requests. It then occured to me that you can simply ‘right-click’ a resource in chrome and ‘Copy as cURL’. »

Ben Squire

Futureproofs API Optimisation

In an attempt to increase the speed of the Futureproofs API, we made several tweaks to the environment and the code, below is a summary of the ones I can remember. Installed Profile Tools I've used xdebug for many years, its comprehensive, but quite resource intensive. A few years ago facebook released xhprof, which is a PHP profiler designed to run on live systems (its uses very little resource). Unlike xdebug and cachegrind XHProf doesn't run across all code automatically, you ‘start’ timing and ‘end’ timing by calling custom functions included in the PECL library. »