Web Hooks, Callbacks and Distributed Observers

Someone at AMEE pointed out to me that there’s been a flurry of activity around so-called “Web Hooks” when I referred to the concept. This is quite heartening as I thought of this a couple of years ago and implemented this in Smartmessages early last year! I call them callbacks, but the idea is the same – it’s essentially a distributed observer pattern. I couldn’t figure out why nobody seemed to understand what I was on about… When I get some interesting event (e.g. a message open, mailshot completion, clickthrough etc), I ping a user-supplied URL with the appropriate event data, pretty much the one-liner that Jeff alludes to. The reason we do it is that sync with external systems (usually CRM) is something that were always running into, and there seems to be no sensible, generic way of dealing with it other than this, so I’m surprised it has not been discussed in this context before.
There’s one downside as far as I can see – it is highly dependent on the receiver to be able to handle the event in a timely fashion. This isn’t an issue if you’re connecting say, Yahoo! to Google, but it could be a big problem if you connect Google to your WordPress blog… My experience of CRM systems is that they are simply too slow to cope with the high rates of traffic that we are likely to generate, for example, if we point a stream of ~200 events per second at a CRM system, it will probably just bog down and fail (I’m thinking of the SalesForce API here which typically takes 1-2 sec to deal with a single SOAP API call). Retrying will only make this worse. I have two solutions for this: limit events to those that don’t happen so often (kind of lame!), or alternatively, use an outbound message queue to rate-limit the sending (Amazon SQS and Memcacheq spring to mind). Queueing works, but you lose some of the real-time aspect. Ideally clients would implement their own incoming queue in order to allow them to process events at their leisure, but this is mostly beyond the vast majority of web authors (or at least those that host the CRM systems that we hear from!).
Anyway, it’s nice to know that I’m not completely barking…

PHP London Conference 2009

From this truly excellent conference, I took away some good memories, some new ideas and a nasty bout of conference flu. There’s nothing quite like being in close proximity to a few hundred people to really spread things around…
Highlight for me was Aral Balkan‘s keynote. It’s always nice to see someone showing plain enthusiasm, and I couldn’t agree more with him about the “lost magic” of computing. Had a chat with him afterwards about AMEE and other things. He also seems to have put together some odd but dull things that I had noticed a need for – EU VAT codings and ISO language references as web services!
I didn’t really enjoy David Soria Parra’s talk on sharding. It all came across as very negative and many of the ways of doing it and coping with the fallout were not really discussed. No mention of MySQL 5.1’s partitioning (which is limited, but is at least a start), or more radical approaches like Sequoia.
David Axmark’s talk on Drizzle was more interesting than I expected, nice to see effort being put into this direction.
Microsoft really does seem to be trying a bit harder these days – their CSS test suite for IE8 is very welcome, and the effort they are putting into PHP, apache and other projects benefits many people. It has to be said that while it’s not a mainstream product, Surface is really pretty cool to play with.
Chris Shiflett’s talk was excellent too; his demos and examples were particularly good, and entertaining.
The post-conference social was great fun, I met lots of nice new people. After our move to France I suspect it will be harder to get to events like this, so I should make the most of them while I can!
I’ve had several ideas for talks that I’d like to do (I get sick of email sometimes!), so I guess I need to get a bit more proactive on actually submitting them to a call for papers.

Scalable irony

This article on highscalability.com is a really excellent rundown of some of the options available for scaling a site to the heights of Digg. Ironically enough, at the time of writing the highscalabilitycom web server shows this error:

Unable to connect to database server
The MySQL error was: User highscal_admin already has more than ‘max_user_connections’ active connections.

I can point them at this really good article on how to avoid problems like this… oh, wait…

Mixers

I’ve had a little Behringer UB802 mixer for some time and found it very frustrating to use as a front-end to my computer system. There’s nothing particular wrong with it (clean audio, good functions, simple, reliable), it’s just not very well suited to the job, mainly because its routing is not flexible enough to be used for audio input at the same time as output. One big problem I had was that the mic I use for audio input (mainly for Skype) routed to my speakers too; a recipe for feedback and poor input level.
In order to resolve all this, I’d been contemplating a Soundcraft Compact 10 as it seemed to have much better routing options. Last week I managed to pick up the smaller Compact 4 for a mere £30 on eBay (I figured I could live without the extra size and inputs for that price). What a difference! It achieves its wonders by having an additional “recording” mix buss. It also has separate routing for monitoring. Each channel has a button that when pressed, routes that input to the recording buss and removes it from the main mix. Similarly there is a monitor button that routes it to the monitor buss. if neither are pressed, it goes to the main mix, which you can conveniently route back to the monitor mix too. Multiple mix busses are par for the course on bigger mixers, but almost nobody does it for small mixers, yet there are tons of n:2 small mixers around that are used in this role, suggesting there are a lot of frustrated users that don’t know there is a way out. As Soundcraft’s manual says:

Why don’t other manufacturers design consoles like this ?
a) Because they are out of touch ?
b) Because they are not very innovative ?
c) Because they don’t have the experience ?
d) Because they don’t listen to their users ?
Who knows :-)

The upshot of all this is that I can route the microphone to the computer’s audio inputs without having it also appearing on the mix bus going to the monitors. As far as I can tell, this routing flexibility makes the Soundcraft about the only small mixer that’s actually designed for this role. Most seem to gloss over this routing problem, or not want to “confuse” users with the concept of an additional mix buss. As an added bonus, it has two headphone outputs that are independent of the mix output, so I can turn my speakers down without turning down my headphones. The Behringer tries to do this, but only by giving you main and monitor mix levels, but as far as I can see you never really need the main mix outputs, only the monitor mix. The only real workaround for simple n:2 mixers is to have a separate mixer for input and output, which is quite a reasonable proposition when you see the price of things like the Behringer Xenyx 502, but I’m much happier having it in one box. Behringer make bigger mixers that have more busses (I think the cheapest is the Xenyx 1222FX), but they are also bigger, more complex and more expensive – overkill for my application.
It’s also interesting to contrast the marketing. Behringer describes the 802 as having 8 inputs, which is technically true – 2 mono, 2 stereo, and a stereo return – but in reality that’s only 5 independent inputs (total of 10 input channels). Soundcraft go the other way – the Compact 4 has 5 independent inputs at a push, but you can actually squeeze 8 channels into it in total, and you can actually get 16 channels into the Compact 10. British understatement at work?
The Behringer is still a great little mixer, and I’ll miss its diminutive size, the aux send, and a couple of extra inputs (which, now I’m firmly in software-synth land, isn’t really a problem any more). Anyone want to buy my UB802?