How can I show list of groups with count of the group's participants with the groups in social media app? - node.js

I am working on a social media react-native app with Node JS in the backend having approx 1 million users.
I have to show a list of suggested groups to the user with the total members in the group.
Currently, I am using a count query that is taking time to calculate the total members each time.
What should I do to optimize this API or scenario?

That's a good Question. First approach is add a column in each table. 2nd approach is create a new table of count. In count table save all the counts of the app. 3rd approach is using the DB cache or backend cache.

Related

Using web scraping to recive all Twitter followers

I want to create giveaways which require the participants to follow the twitter account of the giveaway creator.
My first idea was to use the Twitter API (endpoint: "/2/users/:id/followers"). This works fine for me however I always run into rating limits. The API allows me to send 15 requests every 15 minutes and returns a maximum of 1000 users per request. Since many accounts have more then 15000 followers and since many request happen at the same time (many users want to participate in a giveaway) this solution is not suitable for me.
My secound idea was to use web scraping instead (e.g Node Fetch). I was following along this tutoria: However doing so I always run into the issue that Twitter uses random strings to name their html elements. You can see in the picture there is no defined class to grap the elements.
So my main question is how can I access these element ?
Random Follower of my Twitter Account
I also have a follow up question regarding the effictivness of this method. Assuming I have multiple people who want to particpate in a short amount of time (e.g 10 people in 5 minutes) and they all need to follow a big twitter account (e.g 100k followers).
Is it efficent to scrape all 100k followers each time or should I instead try to fetch the 100k followers once, safe them to my database and use my database to check for each user later ?
As a side note, I am using node.js and node-fetch, however I have no problems to switch the framework. In addition I think the grabbing of the element as well as the performance should be universal.
Thanks for your help :)
They're going to detect your servers excessive calls. There is a Twitter Developer Portal where you can request elevated access which may raise the limits for you.
https://developer.twitter.com

Kentico: Limiting number of contacts to load in contact application

is it possible to load only recent 10000 contacts in Kentico contact application? Right now, the number of entries in om_contact has more than a million and Contact application won't load.
Is there any other way as all of the contacts are important to us.
One of they way could be to archive table data and delete old one but users won't be able to work on them from Admin UI.

How do you aggregate social activity using Postgres?

In this app I have users, posts, and groups. Users post to groups, of which many users can be a part of.
I'm trying to aggregate all this into a feed where if a multiple groups you're part of have a post made to them (in consecutive order, with no activity in between) it groups it into 1. So you'd see "Posted in 5 groups" instead of the post 5 times in your activity feed.
Example of the schema & desired result
How would you do this with Postgres queries? Imagine thousands of posts in various orders, and you only want the newsfeed to show related activities that are right next to each other
Also I'm using node js for backend if there's any libraries to do that. Thanks!

GetStream Multiple Feed Instances of same group per user?

Is it possible to create multiple feeds of a feed group s.t. users can join multiple feeds of the same feed group? Specifically, we would like to create a game feed view all players in the game can see updates and post reactions/comments. Players can be part of multiple games and each game feed should be separate from any other. Is this possible using getstream and what would be the best approach?
From reading the documentation, it seems that one cannot use API to dynamically create feed groups. However, I think it should be possible to create multiple feeds of the same feed group but in their documentation (https://getstream.github.io/react-native-activity-feed/#flatfeed) it seems to suggest that we just pass the feed group and user id, which makes me think we can only create a feed per feed group per user?
Definitely, it's possible.
For example, game:game-id and users can have their own feeds too user:user-id.

Performance tile showing different records for same method

Currently in Performance tile in Insight we have performance detail for the application request.
If we have an API like:
GET /order/{orderId}
so, for this kind of request, it showing as different request and matrix is also different for different orderId.
But for the owner point of view, this is a same request and needs to have shown under one request for all call for this method.
For the above mentioned API, if we have the request coming as:-
/order/1
/order/2
/order/3
Then in Azure portal, under performance tile for Application insight, it consider this as different operations and hence show stats individually for each unique request.
But as per the developer, this is a single API and needs to monitor as single operation.
How to achieve this in Azure portal?
In the Performance tab, you have the ability to add filters for your results but in your scenario I would:
Click on View in Logs (Analytics)
Select Requests
Add an appropriate contains statement: | where operation_Name contains "GET /order"
At this point the Overall line contains the total Duration Average and Count shown in the Performance tab, as well as percentile information for all orders.

Resources