Hello webmasters,

I have a website about memes and I want to update the database each time the user scrolls down.
I have no problem when I make a few requests to the database, but what if I want to do a lot of requests in a large database?
I recently had to refactor my code to exclude some code that is important just for the sake of performance.
Is there any way around it? How does Facebook do it?

Recommended Answers

All 3 Replies

You can write to an in-memory table or to a cache (such as memcached or redis) with rolling activity logs, and then do batch jobs to update multiple rows in the database at once.

What is your front-end (or better yet, what is the URL of the site, so we can see the front-end)? A couple of things worthy of a search are "debounce" and, if you have jQuery, "scrollstop" since these will fire much less frequently than window.onscroll.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.