Question

I'm writing a social app in Django where all users sign up through Facebook using Python Social Auth. All content that a user sees will be content created by her Facebook friends. Initially, I planned on creating individual users with no database relationship to each other, and relying on requests to Facebook to determine what content to display for each user. Now I'm concerned that this might be a bad idea.

Here's what I've considered:

Advantages

  • Less database management
  • Don't have to worry about updating friends when two users become friends or cease to be friends

Disadvantages

  • Requires many requests to Facebook which could be a performance issue
  • Seems like it could run into scaling issues

Is this a bad idea? Should I be storing these friendships in my own database and referencing them there?

Was it helpful?

Solution

Caching the user/relationship data locally will certainly make your application much faster because your backend doesn't need to perform as many time-consuming queries on the facebook API on every single request.

Also keep in mind this clause from the Facebook API service terms:

11.If you exceed 5M MAU, 100M API calls per day, or 50M impressions per day, you may be subject to additional terms.

That means that when you have more than 100 million API calls per day, they might send you a bill of undetermined size and threaten to cancel your API access when you don't pay up. We don't know anything about the scale of your operation, but when you avoid doing multiple API calls on every single page request you can considerably increase the scale on which that restriction becomes a problem.

Licensed under: CC-BY-SA with attribution
scroll top