<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Talk Unafraid &#187; architecture</title>
	<atom:link href="http://www.talkunafraid.co.uk/tag/architecture/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.talkunafraid.co.uk</link>
	<description>The (occasionally coherent) ramblings of a geek</description>
	<lastBuildDate>Sat, 07 Jan 2012 22:24:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Next steps: Video streaming and production</title>
		<link>http://www.talkunafraid.co.uk/2011/05/next-steps-video-streaming-and-production/</link>
		<comments>http://www.talkunafraid.co.uk/2011/05/next-steps-video-streaming-and-production/#comments</comments>
		<pubDate>Mon, 16 May 2011 18:35:14 +0000</pubDate>
		<dc:creator>James Harrison</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Radio]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[broadcast]]></category>
		<category><![CDATA[driac]]></category>
		<category><![CDATA[flumotion]]></category>
		<category><![CDATA[freej]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[hd-sdi]]></category>
		<category><![CDATA[icecast2]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[radio]]></category>
		<category><![CDATA[realtime]]></category>
		<category><![CDATA[sdi]]></category>
		<category><![CDATA[student]]></category>
		<category><![CDATA[surhul]]></category>
		<category><![CDATA[theora]]></category>
		<category><![CDATA[tv]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[vorbis]]></category>

		<guid isPermaLink="false">http://www.talkunafraid.co.uk/?p=1324</guid>
		<description><![CDATA[I&#8217;ve done a lot of blogging on radio and Rivendell in particular. I&#8217;m a huge proponent of open tools and technologies wherever possible because it provides tons of flexibility, is cheap, and in many cases is just as powerful or easy to use as the commercial stuff. Radio and audio is complex, but why stop [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve done a lot of blogging on radio and Rivendell in particular. I&#8217;m a huge proponent of open tools and technologies wherever possible because it provides tons of flexibility, is cheap, and in many cases is just as powerful or easy to use as the commercial stuff. Radio and audio is complex, but why stop there? At Insanity we&#8217;ve been evaluating video streaming as a way of adding to our existing broadcasts and coverage, as video can be far more engaging to consumers than audio, particularly in the YouTube era. But with Insanity, we have one major problem: We don&#8217;t have any money!</p>
<p>So, you might figure that&#8217;s a problem. You&#8217;d be, partly, right. Video involves a lot more data, loads more numbers to crunch as a result, more bandwidth, and so on. Not to mention the relevant methods of capture are immensely more expensive to implement than the equivalent-quality audio. I&#8217;d like, though, to highlight a few nice things for open source video and production.<span id="more-1324"></span></p>
<p>For any broadcast worthy of the description, we want to be able to do this:</p>
<ul>
<li>Work with multiple camera feeds both close to and further from the computer</li>
<li>Fade between cameras</li>
<li>Overlay static graphics</li>
<li>Overlay dynamic text</li>
<li>Add decent-quality audio</li>
<li>Stream to as wide an audience as possible</li>
</ul>
<p>So let&#8217;s start with cameras. Cameras are expensive. Buying handicam type consumer-grade things won&#8217;t cut the mustard as far as I am aware. I don&#8217;t know enough to speak on the subject of HDMI capture (which things like the Blackmagic Studio can do, purportedly to Linux), but that&#8217;s the only output format those cameras present. Firewire/IEEE1394 remains a popular format of direct capture in Linux. In broadcast, SDI and HD-SDI are now the main format for video/audio transport, and affordable (I say affordable- low-end professional cameras, ~£3,500 on eBay) cameras support it as a standard and again, Blackmagic cards and other capture devices are available with Linux support. HD/SD-SDI are in my mind the ideal format to be working with because as a transport protocol it is capable of long cable runs- meaning your cameras can roam around or be placed where it most makes sense from a camerawork perspective. You pay extra, but compared to any other capture format it makes loads of sense. PC capture cards are not particularly expensive &#8211; a few hundred pounds gets you a card with SDI I/O and balanced audio I/O and analogue video I/O thrown in, too. Stick that in a PCI-E capable box and you&#8217;re good!</p>
<p>This brings me to topic two &#8211; CPU power. Specify the fastest box you can. Right now I&#8217;m testing an encoding-and-compositing-on-one-box setup, and with no cameras connected I&#8217;m at 80% CPU usage on a 2.8Ghz Core 2 Duo. This stuff needs brains. Intel i7 processors are the way to go right now, or high to mid end Xeons. RAM, too- at least 4 gigabytes, more wouldn&#8217;t hurt at all, especially if you use videos in your composites. Aim to keep all your data in RAM, or use an SSD. Multiple computers with gigabit networking will let you split loads across machines, as I&#8217;ll talk about in a bit.</p>
<p>Now so far we&#8217;ve spent a lot on cameras and computers. Fortunately, that&#8217;s all you need (audio equipment aside). Now we get everything in as a source in Linux, we can do the fun stuff- compositing our graphics and videos and text on top of the cameras, switching between them, and then broadcasting.</p>
<p>Composition we have a lot of choice in. We can use freej, which I am very interested in but have been unable to get working properly on Ubuntu so far. Or, we can use WebcamStudio. It&#8217;s a fairly flexible package that lets you do compositing of lots of source types, arranging things into layouts. So we might have an intro layout that has placeholder graphics describing the stream for while we&#8217;re setting up the cameras. Then we might have a couple of layouts that have our camera feeds on them. For a test setup I wrote a small Python script to get the last few tweets from our on-campus media, then told WCS to run that command and put the output on the screen as a rolling text item. Now we&#8217;ve got our video cameras with contributions from news teams overlaid. We&#8217;re starting to look professional!</p>
<p>Audio is a piece of cake. All we need to do is capture it and encode it with the video. The former is too complex to detail here but needless to say you end up bringing in your final mixdown of audio into a soundcard input which you can then bring into my next chunk of software for the post &#8211; Flumotion.</p>
<p>Flumotion is really neat. It lets you build GStreamer chains very easily to do broadcasting, and has a lot of added functionality on top of that like test chains, and crucially the ability to split tasks across computers fairly seamlessly. You can make your rig a network of 3 machines, put video compositing on one, capture on another, and combining and encoding of those streams can be delegated to another machine- for instance. There&#8217;s loads of ways to work with this. Another way I&#8217;ve thought about doing things would be to encode using Driac or another high-res HD codec the feed from each camera on a local Icecast server or HTTP server, then pull that compressed feed down into the compositor, then do the lossy for-broadcast encoding prior to distribution. This has the benefit that you can also write the Driac encoded data direct to disk, giving you clean-feeds of each camera input for later editing and production use. Perfect!</p>
<p>So, how about streaming? Well, turns out this is pretty simple. We use Flumotion to generate a Theora/Vorbis encoded Ogg container, throw it at Icecast2 using the shout2 module, and then use HTML5 video tags with a fallback on the Cortado Java player to embed it into pages. This works without any plugin requirements on most modern browsers, and will seamlessly fall back to Java if HTML5/Theora/Vorbis support is lacking. Perfect! Icecast2 gives us failover and relay options for expansion and redundancy for free, and doesn&#8217;t need much in the way of resources. The fact that we can push to this means that we can site this outside any networks we might be using, and we don&#8217;t have to worry about firewalls at the venue so much as long as we can send out to our remote host.</p>
<p>The main issue here is in making everything realtime. With video, that&#8217;s expensive. I reckon for a two-camera setup including buying computers and ancillary equipment we&#8217;re talking somewhere around £10,000 to £15,000 setup costs. But that&#8217;s actually pretty good &#8211; considering what it gets you. You&#8217;re now a real, bona-fide online TV station capable of real time coverage- something very few places can boast. For student media that&#8217;s a massive boon to both the people running the media and students involved with it, as they can now learn what amounts to the most stressful and complex aspects of TV broadcast production in a fairly safe setting, and for students consuming the media it means much better coverage, more engaging events and more fun in general.</p>
<p>This is a very exciting time for student media, where there is a lot of room for experimentation and improvement to try and provide the absolute best in a safe, controlled environment. Of course, student media means student budgets, but TV is rapidly becoming affordable, and is certainly within the grasp of any SU in the country who wish to go down this path.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talkunafraid.co.uk/2011/05/next-steps-video-streaming-and-production/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to fix voting by popularity</title>
		<link>http://www.talkunafraid.co.uk/2011/03/how-to-fix-voting-by-popularity/</link>
		<comments>http://www.talkunafraid.co.uk/2011/03/how-to-fix-voting-by-popularity/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 05:54:22 +0000</pubDate>
		<dc:creator>James Harrison</dc:creator>
				<category><![CDATA[Odds and Ends]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[commentary]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[elections]]></category>
		<category><![CDATA[rhul]]></category>
		<category><![CDATA[surhul]]></category>
		<category><![CDATA[voting]]></category>

		<guid isPermaLink="false">http://www.talkunafraid.co.uk/?p=1283</guid>
		<description><![CDATA[At SURHUL, the Student&#8217;s Union of Royal Holloway, University of London, we have a problem. I&#8217;m sure it&#8217;s not an uncommon one, particularly at student&#8217;s unions. Our electoral system is essentially a popularity contest. Manifestos, campaigning and student outreach have very little impact on the results. Many positions are uncontested and whoever runs wins by [...]]]></description>
			<content:encoded><![CDATA[<p>At SURHUL, the Student&#8217;s Union of Royal Holloway, University of London, we have a problem. I&#8217;m sure it&#8217;s not an uncommon one, particularly at student&#8217;s unions.</p>
<p>Our electoral system is essentially a popularity contest. Manifestos, campaigning and student outreach have very little impact on the results. Many positions are uncontested and whoever runs wins by virtue of being the candidate who is running; people assume that this means that they care about the position enough to run, and that&#8217;s enough for them.</p>
<p>I don&#8217;t think this is a good way to run elections, and it&#8217;s not something that should be encouraged. But it&#8217;s something that can be very easily fixed, or at least I think so.</p>
<p><span id="more-1283"></span>Essentially- why not make the candidates unlisted? Let&#8217;s say there&#8217;s a candidate running for a position- let&#8217;s call them John Smith. They&#8217;ve been out hard campaigning throughout the week, and you&#8217;ve just gotten canvassed by this candidate on your way to the library. You sit down and decide you should probably vote, so you grab your laptop or a public terminal and load the website up, log in&#8230; and vote.</p>
<p>But here&#8217;s the crucial bit. We use alternative transferable vote for most of our elections, which requires you to put a number by each candidate, ranking them in priority. There are also two meta-options: re-open nominations (RON), and no further preferences (NFP). The way this is presented to you is as a list of all candidates, followed by the NFP/RON options, and you just type in a number by each option in descending order of preference.</p>
<p>The lazy voter just sticks a 1 by the only candidate and hits vote. If we&#8217;re lucky (in terms of improving democracy) they vote for RON as their second preference, or maybe they even vote RON for first preference. In terms of improving democracy by encouraging people to go out and canvass for their position (which is more likely to discourage people running for the sake of running/sticking it on their CV and encourage people who care enough about the position that they&#8217;re willing to go out and get people voting for them), the ideal option is that people vote for people they&#8217;re aware of through canvassing (online or in person) and vote RON for any positions they&#8217;ve not had any contact from people over.</p>
<p>So how can we encourage this over the default impulse to vote for whoever&#8217;s running? Simple- we remove the candidate&#8217;s names from the ballot. <em>&#8220;What on earth is he on?&#8221;</em>, you may well be thinking. Well, here&#8217;s the thing- if we remove people&#8217;s names and require people to actually enter the name of a candidate they want to vote for, people <em>cannot</em> just vote for people because they&#8217;re running; they won&#8217;t know who is running, if anyone. Of course, they can go find out who is running by looking at the candidate and manifesto listings. But this encourages people to find out more about who they&#8217;re voting for, and discourages lazy voting- both good things for democracy. Canvassing gets your name into people&#8217;s heads (and, through flyers etc, into people&#8217;s hands, making the process of voting even easier).</p>
<p>And because our votes are 100% online, the process of typing in someone&#8217;s name can be made easier &#8211; if we want to vote for John Smith, we type J and are immediately autocompleted to John Smith. This entry is now an entry we can put a preference number by (or in perhaps a better UI, we could have draggable lists to make specifying preference easier). This stops people with complex names from being disadvantaged against other candidates in elections.</p>
<p>So with this system, the view that would greet you on any election position vote page would be &#8220;Hello, this is the election for the position of X. Type a candidate&#8217;s name in below, re-order the entries so the option you most want to win is at the top and no further preferences is above any entries you don&#8217;t want to cast a vote for, and press vote&#8221;. Voters would either just click vote to vote for re-open-nominations, or could go look at the manifestos etc and see who&#8217;s running and why, type in the people they want to vote for, drag the markers around, click vote, confirm their vote after seeing a screen detailing their vote, and then they&#8217;re done. Simple as that.</p>
<p>I figure I might do a quick proof of concept system that demonstrates what I&#8217;d imagine a voting UI to look like that used this system. I don&#8217;t see any major downsides to this system, but I&#8217;d love some feedback if I&#8217;m missing something obvious. And if people think it&#8217;s a good idea, who knows- maybe we&#8217;ll get this to a general meeting and see about making it the standard, or at least get it trialled.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talkunafraid.co.uk/2011/03/how-to-fix-voting-by-popularity/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Time-series data in Redis</title>
		<link>http://www.talkunafraid.co.uk/2010/12/time-series-data-in-redis/</link>
		<comments>http://www.talkunafraid.co.uk/2010/12/time-series-data-in-redis/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 00:23:56 +0000</pubDate>
		<dc:creator>James Harrison</dc:creator>
				<category><![CDATA[Odds and Ends]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Radio]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[redis]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[time series]]></category>

		<guid isPermaLink="false">http://www.talkunafraid.co.uk/?p=1200</guid>
		<description><![CDATA[For Insanity, I&#8217;ve been working on some of the support services that are built into the website that provide our staff with information from ancillary services and tools and bring it into a clear and useful format for decision making and monitoring. Latest on the agenda has been listener figures from our Icecast streaming servers. [...]]]></description>
			<content:encoded><![CDATA[<p>For Insanity, I&#8217;ve been working on some of the support services that are built into the website that provide our staff with information from ancillary services and tools and bring it into a clear and useful format for decision making and monitoring. Latest on the agenda has been listener figures from our Icecast streaming servers. While this isn&#8217;t a perfect benchmark of our performance since we broadcast on traditional media too, it is certainly one of our most important benchmarks in measuring show quality and popularity, not to mention listener habits and trends.</p>
<p>We&#8217;ve historically relied on a RRDtool database updated with Munin and an icecast plugin. While this served us well in the single-server days, we recently added a relay server to help listeners with network problems connecting to our JANET-hosted box. Now we have to handle summing two statistics sources and compensating for the added relay connections. At this point I weighed up writing a Munin plugin versus rolling my own and decided to try whipping a solution up using Redis.</p>
<p>Redis is mind-blowingly fast, and exceptionally flexible to boot. We&#8217;re already planning to use it for caching, so it makes sense to use it for statistics storage. So, the goal here was:</p>
<ul>
<li>Fast inserts</li>
<li>Very fast retrieval of arbitrary time ranges</li>
</ul>
<p>Simple goals. I did some digging around and there&#8217;s a lot of different approaches to storing time-series data in Redis. The scheme I used in the end uses sorted sets to store data, indexed by the timestamp, and with the timestamp included in the data to allow for duplicate values. The sorted sets are partitioned by day; for a regular update interval we&#8217;re looking at ~8,000 points per day.</p>
<p>Updates take a bit longer because Redis has to do sorting on insert, but that&#8217;s actually scalable &#8211; O(log(N)) &#8211; and the losses there are regained tenfold when doing retrieval. We keep the datasets small by the partitioning, meaning that N in O(log(N)+M) is kept low- M is dependent on the query. I have yet to benchmark this all because I have yet to notice the extra performance hit on the pages- it&#8217;s snappy in the extreme. We&#8217;ll have to wait and see on how well it scales up, of course.</p>
<p>We do get a bit of overhead because we have to split the timestamp and value apart before we can use either. But that&#8217;s pretty trivial overall. We&#8217;re also putting the statistics into a GSL vector using rb-gsl-ng, which means subsequent stats operations on the dataset are fast; we can generate a page with 80-odd sparklines and statistics summaries generated from 80 different queries without adding more than 50ms to the page load time, which is completely acceptable. Overall, this is working very well indeed. I&#8217;d love to see Redis add more innate support for timeseries data with duplicate values, but for the time being this workaround is doing okay.</p>
<p>As an addendum to this post, <a href="https://github.com/jimeh/redistat">redistat</a> is another tool worth mentioning, partly for the similar application but also for the alternative method of storing key/value data in Redis, albeit in a manner more geared towards counters rather than time-series statistics data. Worth having a look at if you&#8217;re interested, in any case.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talkunafraid.co.uk/2010/12/time-series-data-in-redis/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

