Skip to main content

How Facebook made News Feed 50 percent faster on iOS

How Facebook made News Feed 50 percent faster on iOS
How Facebook made News Feed 50 percent faster on iOS

Facebook also rewrote the code for timeline, groups, pages, search and more, but noticed that News Feed got slower with each release.

Facebook’s Adam Ernst, in a detailed blog post, explained that the problem was in the data model layer:

First, let’s talk about how News Feed was designed to work on iOS.
 The Facebook APIs we use serve as a JSON representation of the stories in your News Feed. Because we didn’t want UIViews to consume JSON directly — there are no type safety or hints about what fields you can expect to get from the server — we create intermediate data models from JSON and used those to power the user interface.
 Like most iOS apps, we chose to use the system default framework for managing data models: Core Data. Already built into iOS and very well documented, it allowed us to get the native rewrite out the door without reinventing the wheel.

Returning to our performance problems, though, we found that Core Data had a quirk. As we ported more features, our Core Data database slowed down.
 We started with only a few dozen entities in Core Data, but this had ballooned to hundreds. Some of those entities had a lot of fields — Pages, for example, had more than 100!

Under the hood, Apple’s Core Data framework uses SQLite to store data. As we added more entities and more fields, the number of tables, columns, and indexes grew.

 Core Data stores data in a fully normalized format, so each time we encountered a Pages object in JSON, we would have to perform a fetch-or-create in Core Data and then update the page.

 Saving would touch dozens of indexes in SQLite, thanks to an enormous number of relationships (i.e., how many things reference people or Pages objects on Facebook).

Popular posts from this blog

Moz: Google’s New Quick Answer Box Now Showing 98% More Often

Moz: Google’s New Quick Answer Box Now Showing 98% More Often According to a Moz tracking study the new formatted quick answers box you find in Google for queries like [what is seo] is showing up 98% more often than a week ago. Overall, general answer boxes, including stock quotes, weather forecasts, box scores and so on are showing up 44% more often. What are direct or quick answers from Google? Here is a picture of an example; but keep in mind it may or may not show images or photos within the box. However, they are different from the Knowledge Graph panel in that they are at the top of the search results. Moz: Google’s New Quick Answer Box Now Showing 98% More Often Moz said the day-over-day increase from September 25-26 in new answer boxes was +98%, almost doubling the total number in their data set. Here is the graphic: Moz: Google’s New Quick Answer Box Now Showing 98% More Often This is not to say that these answers show up for 50% of the search queries you do; they do not. But ...

21 Link Building Ideas That Have Nothing To Do With Guest Posting

21 Link Building Ideas That Have Nothing To Do With Guest Posting I think we’ve gotten better at not relying completely on guest posting as the only way to get links. I think. At least, I sure hope we have. Don’t get me wrong: Guest posting done correctly still works really well – note the emphasis on “done correctly.” I’m not recommending you remove it from your tactic list, but a little tactical diversity never hurt anyone. Note: I’m keeping these high level and vague on purpose in order to inspire as many starter ideas as possible. I find this to be ideal for brainstorming. It’ll be up to you to take the ones you like, add your own twist, and flesh it out to make it work for your company. (C’mon, I can’t do all the work for you!) PR Boilerplate. Press releases aren’t dead. Make sure you have an optimized boilerplate at the end of all of your news releases that talks about your company. It’s almost always included if/when your release gets picked up by another source. Executive Bios....

Google Launches Mobile Friendly Test Tool

Google Launches Mobile Friendly Test Tool The new tool is at google.com/webmasters/tools/mobile-friendly and it basically gives you a pass or fail grade. Either it tells you that you are mobile friendly or you are not mobile friendly. The messages I was able to generate include: Awesome! This page is mobile-friendly. Not mobile-friendly In each output, the yes, you are mobile friendly or no you are not, Google may or may not give more or less advice depending on the site. For example, for this site, we got an “Awesome! This page is mobile-friendly,” but it did add that “this page uses 9 resources which are blocked by robots.txt. The results and screenshot may be incorrect.” It then listed out those resources it had issues with, so you as the webmaster can decide if it is something that needs addressing. Here is a screen shot: Google Launches Mobile Friendly Test Tool I then tested a site that I know what not mobile-friendly and Google explained what the issues were including (a) text t...