[FEATURE] Performance improvements to the profile page
Description
I think there are various performance improvements we can make to the LinkFree app, but this issue is focusing on the profile page
Currently this is the workflow of the file and I think some could be off-loaded to a serverless function as to be non-blocking for the page to return the data?
- load json file
- load profile
- increment profile counter
- increment app total profile view counter
- increment profile counter for that date
- check for location, and fetch if cache expired
I think we need steps 1, 2 and 6, can steps 3, 4 and 5 be done async and not effect the page load time?
API file pages/api/profiles/[username]/index.js
https://github.com/EddieHubCommunity/LinkFree/blob/main/pages/api/profiles/%5Busername%5D/index.js
Screenshots
No response
Additional information
No response
To reduce notifications, issues are locked until they are ready for dev and to be assigned
@eddiejaoude Hello sir can you elaborate this issue
@Bharadwajshivam28 I have added some more information to the issue description
@Bharadwajshivam28 I have added some more information to the issue description
Okay sir i will check it
users Api route has been renamed to profiles
The new api route and files are
pages/api/profiles/[username]/index.js
https://github.com/EddieHubCommunity/LinkFree/blob/main/pages/api/profiles/%5Busername%5D/index.js
@eddiejaoude This queuing of operations to be done in async manner and having to wait for only those which are really needed to feed the data to FE - sounds great and will have lot of improvement in the response time.
Apart from this, I'm not really familiar with the existing implementation, But, loading the profile page is something we would have the most/frequent requests for in the system. I would suggest to have the profiles data to be maintained and fetched from in-memory/cache storage first on profile load request (preferably Redis).
It might require major changes at the BE to manage data in Redis and maybe some server cost as well 😅, but, we will have significant improvement in profile load. Maybe we can try out a POC around this and benchmark the performance.
@daxitpatel thank you for your suggestion, but this issue is not about reads it is about writes, wherever we read the data from we still need to write otherwise the stats will not be recorded
As there have already been small improvements to this I will close for now.