Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Not looking for any code snippets here, so here goes:

Let's say 100,000 users on my web app have authorized my application to connect to facebook (with or without offline_access). I want to build a sort of "pull" mechanism, whereby when a user posts to their facebook wall, I can grab it from the Graph API and store it locally on my server.

I would assume that this would require a call to the Graph API every n minutes to pull their latest wall posts.

Ideally, this would be done for Twitter as well. I know LinkedIn does this, but I am not sure of the exact details.

Question 1: I'd need to make an individual Graph API call for each user, right?

Question 2: If I suddenly bombard the Graph API with 100k Graph API calls, wouldn't I run head-first into the rate limiter?

Question 2b: If not, what if I had a million users? Surely...

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

There's not really any need to build the "pull" mechanism when you can have Facebook POST you graph updates. I'm not entirely sure about limits on this service.

As for your individual questions:

Question 1: I'd need to make an individual Graph API call for each user, right?

No. You can issue requests for multiple users. See the "Selection" section in this doc. However, I'm sure that there's a limit to the number of users that you can query at once (not sure about the number though).

Question 2: If I suddenly bombard the Graph API with 100k Graph API calls, wouldn't I run head-first into the rate limiter?

Yep, which is probably why you'd want to have the data pushed to you rather than pulled.

Question 2b: If not, what if I had a million users? Surely...

Don't build for what you think, or hope you might have.. Build for what you know you have. Refactor and optimize when the time comes. Not now.

share|improve this answer
    
I had no idea you could subscribe to real-time updates from Facebook... is this a new feature? It seems to be exactly what I need. Thanks! –  Julian H. Lam Nov 2 '11 at 19:50
    
I don't remember seeing it the last time I developed something using the graph API, so it's probably relatively new. –  Demian Brecht Nov 2 '11 at 19:52
    
Seems like your answer to Question 2 would imply that its better to design for today and not worry about the application being able to scale. I am not saying this is wrong I am just asking if this is what you meant and was hoping you could add some detail to why you think that's the best approach. It's seems counter productive. I may be over simplifying your answer. –  Ominus Nov 2 '11 at 20:05
    
Do you mean 2b? Of course horizontal scaling architecture is best practice, but not always a strict requirement. Sometimes (especially in a prototype stage), it's best to just getting something up and running and then refactor as required rather than build an overly complex solution based on what you think you'll have as a user load. If your app bombs, then you didn't spend all that extra time building the perfectly scaling application. –  Demian Brecht Nov 2 '11 at 20:53
    
Having said that, ensuring that you haven't design scalability out should definitely be a core requirement of any architecture. This should be handled nicely by abstract, modular subsystems. –  Demian Brecht Nov 2 '11 at 20:55
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.