How to outsource Following-Feed to GraphQL from Google Firestore - node.js

I have an app built on Firestore. Each user can make a post, and getting these posts on the users' pages is easy, since they all have their posts in a SubCollection "Feed". That's great!
These users, can follow other users, and what isn't great is how expensive it will be so create a functional news feed. I've calculated the costs and sensed it would be cheaper to write each post to each followers following feed, than it would to read all recent posts by all followers dynamically. However, this is still ridiculously expensive and the first blocker I've seen in firestore. However, it's understandable since it's NoSQL.
I was wondering, though, is it possible to have a GraphQL DB, so that every time a user creates/updates/deletes a post, it is added into both their feed, AND GraphQL, so then when the time comes when a user wants to see the posts of the users their following, I can just do a massive "where-in" query, sorted by the date created?
Has anyone ever done this? I assume it would be more cost-effective than trying to do a news feed with NoSQL.
Would I be able to drum up a GraphQL server on Google Cloud and connect it to from a cloud function?
I have tried both adding each new post to every follower's following feed, and reading all followed users and querying the most recent posts. Both are extremely expensive, albeit the writes per post is cheaper.
These are my findings concerning writing each post to the folllowers' feed:
For 10 users with 100 followers, when they post 1 time(s),
it will cost 1010 writes: $0.001818
For 10 users with 100 followers, when they post 12 time(s),
it will cost 12120 writes: $0.021816
For 100 users with 100 followers, when they post 1 time(s),
it will cost 10100 writes: $0.018179999999999998
For 100 users with 100 followers, when they post 12 time(s),
it will cost 121200 writes: $0.21816
For 1000 users with 100 followers, when they post 1 time(s),
it will cost 101000 writes: $0.1818
For 1000 users with 100 followers, when they post 12 time(s),
it will cost 1212000 writes: $2.1816
For 10000 users with 100 followers, when they post 1 time(s),
it will cost 1010000 writes: $1.8179999999999998
For 10000 users with 100 followers, when they post 12 time(s),
it will cost 12120000 writes: $21.816

Related

Azure Form Recognizer pricing

"I've got some questions about the Azure Form Recognizer pricing. The website says $50 per 1000 pages for the S0 Web custom document type. If I upload a 1000 page PDF but make 10 API calls on each page, will we be charged per API call to the uploaded document or based purely on the number of pages? So would we expect a $50 bill or a $500 bill for those 1000 pages?"
Well, I had this same doubt and drilled down a bit more to figure out that it is based on the number of pages you analyze using the API. So in your case, since, you are calling the API which is essentially analyzing the pages of the document, the bill would be $500.
However, it is always better to save the results and refer them later as with one model the result will always be the same for the same document/page.

Instagram Rate Limit

Are the endpoint-specific rate limits per access token, or for app period. Lets say I have 100 users of the app, (100 different access tokens) that make a relationship post request, is that not going to work? Or is it 60 requests max per user of the app, and no more than 5000 total requests from the app every hour..
Each user can make total of 5000/hr API calls, POST API calls have different limits like relationship POST call has 60/hr. There is no limit for the app, each access_token (user) has a limit.
Update: As jhm pointed out, this limit has been reduced from 5000/hr to 200/hr as of April 1, 2018.
As per the April 1st 2018, the rate limit has been significantly reduced - from 5000 to 200 pr hour pr user:
https://developers.facebook.com/docs/instagram-api/overview/#rate-limiting

instagram api: getting user information and rate limits

I'm a little confused if what I am trying to do is even possible given the expressed limits to the API.
My app should do this:
user logs in, app gets auth token
user gets list of their followers
https://api.instagram.com/v1/users/self/follows?access_token=ACCESS-TOKEN
this point is easy to get to, but the next step (3) seems potentially problematic
user gets the number of followers each of those followers has
https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN
If the user has 5000+ (limit is 5000 requests per hour) followers, do I really need to request each users information one by one? If so, it looks like I will definitely hit the rate limit.
user is able to delete followers having under a certain amount of followers (limit 60 / hour)
https://api.instagram.com/v1/users/{user-id}/relationship?access_token=ACCESS-TOKEN
So, it seems, given the limits, that such an app would be impossible to create. Is there some channel where I can request a limit increase? This tool would be used sparingly and infrequently.
There is a section "Relationship Endpoints" where you can use request
GET/users/self/followed-by
https://api.instagram.com/v1/users/self/follows?access_token=ACCESS-TOKEN
to Get the list of users this user is followed by, so this is only one request.

How many posts will Instagram's Tags/Recent Media Endpoint return?

We are using Instagram's Tags API, specifically the recent media endpoint. We ping every 10 minutes, and grab the newest posts since the last call. My question is how many posts will be returned? If we ping every 10 minutes, and 1,000s of posts happen with the hashtags relevant to us, will all of them be returned? Or will it max out at 20 or something and we have to keep paging through? Will it skip posts after a certain point? Unsure how this works.

Instagram API Access Limit

We require to get the followers data (profile metrics specially follower's friends count) for my client's accounts having more than 500k followers. Because of Instagram api limitation we can only do 5k calls /hour. Thats why, it is impossible to load all followers data for every day. But there are few products like web.stagram.com etc, which are also using the instagram api and making unlimited (or some greater num than allowed limit) calls.
Are these partners exempted by instagram?
Please update if there is a way to get higher api limit.
We are ready to pay amount for the higher limit.
Regards,
Parvendra Adhran
You have to try to get whitelisted to get a new Rate Limit, there's a long waiting list and Instagram has mentioned they won't be getting to the requests anytime soon.
I've heard of people still waiting over 2 months so far.

Resources