Last night I presented my Facebook development experiences to the crowd at Tokyo 2.0. I’m not going to repeat myself as most of the information I presented I’ve already written about in the facebook section, but I’d like to share the presentation data: odp or pdf and mention my references:
Archive for the 'facebook' Category
I wrote an overview on using ec2 for hosting facebook apps a few months back. I’ve been poking around a little more with EC2 lately and have a couple of items to report back.
Facebook ‘hello world’ Public EC2 image
I spotted this public ami for getting started with facebook, shipping with:
1. Facebook Client Libraries
2. HelloWorld Facebook Application that lists the objects in your Amazon S3 bucket
3. Footprints Facebook Application that is shipped with Facebook Client Libraries
New Large and Extra Large Instance Types
I mentioned previously about setting up a cluster of servers to deal with the potential high traffic for facebook apps, however amazon have released some more beefy images that could absorb a lot more traffic before showing the strain.
They now have 3 types of instance small, large, extra large:
Small Instance (default) (1)
1.7 GB memory, 32-bit platform
1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)
160 GB instance storage (150 GB plus 10 GB root partition)
Instance Type name: m1.small (used in EC2 APIs)
Price: $0.10 per instance hourLarge Instance
7.5 GB memory, 64-bit platform
4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)
850 GB instance storage (2 x 420 GB plus 10 GB root partition)
Instance Type name: m1.large (used in EC2 APIs)
Price: $0.40 per instance hourExtra Large Instance
15 GB memory, 64-bit platform
8 EC2 Compute Units (4 virtual cores with 2 EC2 Compute Units each)
1,690 GB instance storage (4 x 420 GB plus 10 GB root partition)
Instance Type name: m1.xlarge (used in EC2 APIs)
Price: $0.80 per instance hour
So potentially you could quickly shift from a small instance to large, then to extra large as required.
NB There are still great benefits to going down the cluster route rather than single server though, particular if you’re doing anything with a database (of course you are!) then you’ll really want to have replication onto a separate machine to ensure minimum data loss in the event of failure.
Mr Kirkland was recently interviewed by a journalist from Infoworld (IDG) regarding experiences with facebook development, here’s an excerpt from the whole article - those quotes sound a little harsh!!!
Facebook attracts developers — and controversy
Third-party developers must balance social-networking giant’s generous money-making opportunities with communications and administrative pitfalls
By Juan Carlos Perez, IDG News Service
August 31, 2007
Many Web developers these days feel a sleep-depriving mix of unbridled enthusiasm and nagging concern over Facebook’s social-networking platform.
………..
Facebook’s user experience has traditionally been considered significantly more elegant, controlled, and organized than the one from key rival and social-networking leader MySpace.
Although MySpace remains more popular, Facebook has been gaining momentum for the past 12 months. Its user ranks have ballooned to 37 million active users today from 12 million in December. More than half of its active members return to the site daily.
A company called Slide, which creates “widget” applications for social-networking sites and is big on MySpace, jumped on the chance to set up shop on Facebook, which has quickly become one of its most important platforms.
Although Slide has created some of the most popular Facebook applications, its detractors have criticized it for engaging in some of the inappropriate tactics flagged by Morin.
But Slide’s CFO Kevin Freedman said that Slide is as interested as anyone else in providing a good user experience on Facebook and elsewhere.
“We listen to our users’ feedback first and foremost. Regarding some of those [critical] comments, we haven’t necessarily seen the same response from our users and that’s really what drives us,” Freedman said.
Chris Kirkland, CEO of MrKirkland.com, a Web design and development firm, has created three applications for Facebook, but has been unimpressed with the developer program. “I very much consider Facebook to be ‘learning on the job’ with the development platform,” Kirkland wrote in an e-mail.
The tools and resources Facebook provides to developers could be better, he wrote. “Overall we have been extremely disappointed. The documentation is reasonable, though sometimes inaccurate, but by far our main complaint is the diabolically poor level of communication. We have a feeling that we are dealing with a bunch of overbusy college kids,” Kirkland wrote.
He blames this lack of communication for a situation that led Facebook to yank one of his company’s applications from the site with, he says, nary an explanation and, in his view, without justification.
The application, designed to let members track visits to their profiles, received initial approval from Facebook, but then the company turned around and banned it because it lacked a feature Kirkland says they never told him would be required.
He’s fuming that a similar application from a competitor continues on the site. “We were given no opportunity to alter the application, no warnings that they would do this, and my attempts at discussing the erroneous TOS reports with Facebook merely received generic replies,” he wrote.
Using EC2 and Amazon Webservices for Hosting Facebook Applications
Published by August 17th, 2007 in facebook. 3 CommentsMost webdevelopers are used to steady long term growth with occassional spikes, the kind of stuff you can just about get away with on shared hosting or a basic dedicated server. Facebook development can be a completely different kettle of fish, even relatively small apps can expect thousands of regular users hitting their app every day, and often growing very fast. You can see inexperienced facebook developers being caught with their pants down, how many apps out there are throwing up ‘not responding’ errors within a matter of days of being accepted into the application directory?
So you need to think ahead, particularly about your hosting requirements, you should plan an infrastucture where you can quickly plug in a few extra load balanced servers, and keep plugging more in as your app grows. This involves a set of skills beyond the scope of basic php/mysql app development and with a standard dedicated server setup, a significant increase in cost.
Amazons Webservices is one possible solution, in particular their “Elastic Compute Cloud” - EC2 service. EC2 essentially provides unlimited computing power through virtual servers - nodes, you can clone nodes and start up a new instance of a node within a couple of minutes and the beauty is you are billed by the hour not the month with no start up fees. Additionally you can easily update and save an image of your node so you can continue to tweak your virtual server, save it as an image and then use that image to create more nodes.
How To Set Up A Facebook Application On EC2
So I’ll give a rough outline to how you could host your application on EC2.
- Create An AWS account
- Go through the get started tutorial to get the idea of how it works.
This basically gets you familliar with the command line tools for setting up a node. Once a node is started you get an IP address and just log into it like you would any other unix server. - Plan your infrastructure.
- A typical set up would be Webservers serving the application, Database Master Server, Database Slave Servers.
To get you started, amazon has some good starting points, there is a nice apache webserver image and a separate mysql server image. - Additionally you’ll need to partition your application
- At the very least separate database reads and writes, so all reads are sent to the slaves and all writes to the master
- Consider how multiple webservers can distribute the load, they could all be clones or you could farm of different tasks to different servers
- Think about backup. Again the good thing about amazon EC2 is the fact you can save an snapshot of your node, this is especially nice if all your data is in a database as all you need to do is keep an up to date image of your webserver and do regular database backups, then you could in theory recover from anything in a few minutes (depending on database size). For live database backups you will need to be using replication and you can then safely perform backups of a slave. And you should back up the data to S3 (the snapshot images of nodes are pushed onto s3 automatically).
- A typical set up would be Webservers serving the application, Database Master Server, Database Slave Servers.
- Think about DNS, you’ll need a way of farming the requests to different servers and facebook (at time of writing) only gives one callback url. Fortunately this is fairly easy to get round with round robin DNS which is easy for transparently spreading requests accross your webservers. You will probably prefer to have your DNS separate from EC2 as IP addresses change if a node is shut down.
- Once you have thought through these points, you can now bear them in mind for planning/modifying your app, so next you should start up an EC2 instance (review the getting started tutorial) and start coding
Caveats
- This biggest caveat is ‘no persistant storage’ - if you terminate an instance all data is lost forever. However in the context of such a specific environment as a facebook app, this should not be a big problem, you just need to make sure you have planned a regular offsite data backup and take regular snapshots of your nodes.
- IP Address change, you IP address will change if you terminate an instance so you’ll need to have a low TTL on your DNS servers so IP addresses will never be cached for too long
Attention Developers: Facebook Delete Applications Without Warning
Published by August 10th, 2007 in facebook. 3 CommentsUPDATE Mr Kirkland interivew by IDG
So after an exciting start with our tracker application reaching 8000 users within 3 days after launch facebook have deleted it without warning.
Admittedly we recieved a number of ‘Facebook TOS reports’, but they were all from users that had misunderstood what the application did and were essentially false alarms. Moreover our application had been reviewed and accepted into the facebook directoty and we even had recieved direct confirmation that our idea was okay:
Hi Chris,
Thanks for your cooperation with our policies. To answer your question,
yes, anonymously tracking ‘hits’ would be fine (as long as the user cannot
tell who specifically has been visiting their profile).Please let me know if you have any further questions.
So you can imagine just how pleased we were with the reply after I had questioned the reason for the disappearance of Tracker:
Hi Chris,
Upon further review of your application we found that it violates our Terms
of Service. You asked me if tracking the number of hits anonymously would
be within our Terms of Service. This would be, but it should only be
possible if the other user visiting the site has also installed the
application. I apologize if my answer to your initial inquiry was unclear.
Thank you for letting us know about this other application. We’ll be
reviewing its functionality as well.Thanks for contacting Facebook,
So we were given no opportunity to alter the application, no warnings that they would do this, and my attempts at discussing the erronous User TOS reports with facebook merely recieved generic replies.
Conclusion
If you are developing a facebook app, watch out it might suddenly dissappear!

Okay so the first facebook application realeased by MrKirkland hasn’t quite hit the popularity of Pirates or Zombies, but 10,000 users and almost a million page views in 3 weeks is still not bad in our books.
For our second application we thought we’d try something more practical, a “who’s been on my profile” application. We have dubbed this application “tracker“. However this app had a slightly controversial birth, namely we had to axe the ‘who’ part of the tracking. Despite a careful review of the Terms and Privacy we couldn’t find unambiguous langauge indicating whether an application recording who has visited your profile would contravene these terms.
So we decided to release the application and wait and see what happened - we’d found the developer help email responses a little slow, so we figured facebook would come to us faster this way! Well sure enough within a few hours of submitting the app to the application directory we received a refusal. However the refusal was rather vague:
Thanks for your submission of “Tracker” to the Facebook Platform’s Product Directory. We have reviewed your application, and unfortunately cannot yet add it to the directory because it violates the Facebook developer terms of service (stores user data beyond the context user session or specified timeout). Please fix this problem and resubmit the application.
So after reviewing the terms, we concluded we were violating the condition relating storing non-permantently storable data for more than 24hours, so our solution was to make only the last 24 hours of ‘who’ available.
We submitted the app a second time and were again refused. Thankfully though we recieved an email specifically indicating our goof:
Thanks for your application submission. Unfortunately we cannot approve
your application “Tracker” at this time because it is in violation of our
Terms of Service. Your application is tracking users who have visited
another user’s profile, even if the users have not opted into the
application. This is a serious violation of our users’ privacy. Please
correct this as soon as possible.
A pity perhaps as without even being in the directory the app had attracted almost 1000 users - seems that this is a popular feature! Anyway, we still felt a profile ‘hit counter’ would be worth having, especially as it seems no one had offered this application yet.
So now the tracker application has just been accepted into the directory, and has made a good start - close to 1000 new users within 12 hours of being listed, that’s about 5 times better than the sentence game!
I admit this title is a bit presumptious, but I can’t help but get excited at the progess so far of the application I just realeased onto facebook. The application is The Sentence Game which is basically a ‘plug in’ to an existing website www.sentence-game.com and since I realesed it (3 days ago at the time of writing) there is now over 650 people who have it installed, only about 10 of my friends. 650 is a small number really but compared to the other apps released around the same time that’s pretty good.
Key Ingredients
Whether or not The Sentence Game takes off, in no particular order here’s what I consider to be some of the key ingredients:
- Good Logo - not essential but will help encourge people to install when your app is new
- Use the social graph - if your app is not making use of the facebook community e.g. it is a standalone app where all the interaction is on the app canvas, then it’s going to be a real struggle to spread the word. Make sure your app has a useful/informative/entertaining prescense on the user’s profile and posting items into their feed when they perform key actions will greatly assist in spreading the word.
- Don’t spam - don’t post too to user feeds much, or post pointless/repeat messages - you might have your account disabled
- Simple is best - if you’re looking for viral then it needs to be simple so new users can ‘get’ it easily
If you’re interested, here’s The Sentence Game’s progress graph:
Total Users
So it took me a while to figure this one out, therefore thought it would be worth posting here…
Facebook currently allows only one url type declaration per style block. So if you have multiple url declarations in your style, you get this error. The solution is to simply seperate the url declarations into separate style blocks:
<style type="text/css">
#div1 { background: url(http://www.imageserver.com/img1.jpg); }
#div2 { background: url(http://www.imageserver.com/img2.jpg); }
</style>
To become:
<style type="text/css">
#div1 { background: url(http://www.imageserver.com/img1.jpg); }
</style>
<style type="text/css">
#div2 { background: url(http://www.imageserver.com/img2.jpg); }
</style>
Hire A Facebook Developer
Looking to hire a facebook developer, click here for more info.
Not exactly hot off the press, but facebook have opened up their site to developers with their ‘platform’ api. This is perhaps a big step forward for social networking. They are letting any developer easily write applications that can poke around very intimately in facebooks ’social graph’. Subject to terms and conditions, developers can release applications for the masses (on facebook) to install on their accounts. Currently the applications are hosted on developers servers, facebook can also send and recieve data to the developers server (call back) and display the results within face book so the applications can reside within or without facebook.com. There’s even scope for desktop applications.
Anyway I’ve been digging around the api and just recently released a client for The Sentence Game….
