<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mediagoblin.org/index.php?action=history&amp;feed=atom&amp;title=Subscriptions</id>
	<title>Subscriptions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mediagoblin.org/index.php?action=history&amp;feed=atom&amp;title=Subscriptions"/>
	<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/index.php?title=Subscriptions&amp;action=history"/>
	<updated>2026-08-31T08:45:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.mediagoblin.org/index.php?title=Subscriptions&amp;diff=612&amp;oldid=prev</id>
		<title>Cwebber: Evan&#039;s explanation of how to subscribe stuff</title>
		<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/index.php?title=Subscriptions&amp;diff=612&amp;oldid=prev"/>
		<updated>2012-03-26T22:00:36Z</updated>

		<summary type="html">&lt;p&gt;Evan&amp;#039;s explanation of how to subscribe stuff&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Scalable subscriptions =&lt;br /&gt;
&lt;br /&gt;
[[File:Evanpro_subscription_tabledescription.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
I had a talk with Evan Prodromou about how to scale &amp;quot;subscription&amp;quot; style feeds.  Here&amp;#039;s the whiteboard he drew and the description of how it all worked.&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m going to describe things in stages, because that&amp;#039;s the way he described them to me, but it would be good if we did it the right (final) way from the get-go, probably.  It sounds like we can retain a lot of hair by listening to this advice. :)&lt;br /&gt;
&lt;br /&gt;
== Stage 1 ==&lt;br /&gt;
&lt;br /&gt;
Evan says &amp;quot;we have a fairly normalized SQL setup here...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The first row here is the &amp;quot;initial stage&amp;quot; of how statusnet did profile subscriptions, and is the most absolute minimal setup you need.  It contains several things:&lt;br /&gt;
&lt;br /&gt;
* A profile table.  This is separate from a users table (profile table contains both local and remote &amp;quot;profile&amp;quot; subscriptions; user contains the information for like passwords, etc.)&lt;br /&gt;
* A subscription table, which shows who subscribes to who&lt;br /&gt;
* A notice table that contains the actual notices being posted (would be media entries in our case)&lt;br /&gt;
&lt;br /&gt;
The original StatusNet way of doing things was to simply do a join across these three tables.  This worked for a while, but eventually it started to &amp;quot;become total murder&amp;quot; to get updates, taking significant numbers of seconds.  So they moved on to another solution...&lt;br /&gt;
&lt;br /&gt;
== Stage 2 ==&lt;br /&gt;
&lt;br /&gt;
The second row shows the table that was added for this solution, which contained each notice pointing at each user, and you&amp;#039;d do a query just grabbing a particular slice for a profile (on the left) and the notice (on the right).&lt;br /&gt;
&lt;br /&gt;
Apparently this also worked for a while, but then became unusably slow.  Which meant they went onto the final solution which was...&lt;br /&gt;
&lt;br /&gt;
== Stage 3 ==&lt;br /&gt;
&lt;br /&gt;
A table that has two columns: a profile id, and a packed blob that contained the 1024 latest notices.  Since 1024 notices times integer bitesize is how much a single page of MySQL data is, in a single short query you could retrieve the first 50 pages of updates.  Beyond 50 pages (most users never click that far), just use normal slow queries.&lt;br /&gt;
&lt;br /&gt;
Evan commented that they only do this for profiles right now (not tags and etc) but they&amp;#039;ve thought about doing it, and this also doesn&amp;#039;t work at all for a &amp;quot;frontpage firehose&amp;quot; type situation.&lt;/div&gt;</summary>
		<author><name>Cwebber</name></author>
	</entry>
</feed>