The question is published on by Tutorial Guruji team.
I’m creating a website that will have articles, and it will support the ability for people to sign up as an affiliate (and get a subdomain) and get paid per ‘View’ that they send to the website (they typically post their links on facebook pages which drive the traffic to my site)
So a typical URL could be
http://johnsmith.mydomain.com/post/an-interesting-article, where ‘johnsmith’ is an affiliates username. Now the problem I am seeking suggestions for is how to go about tracking the views on these articles per each ‘Username’. I have designed the below schema but I know it needs improvements, the site will initially get 30,000 to – 50,000 page views, so writing to a database every single time someone loads a page is completely unnecessary.
The View part is definitely not set in stone, it is just an idea.
Basically I need to store which username sent how many views to a given page. One other thing also, I need to store the IP address because I won’t be paying for clicks that come from certain countries.
Using: MySQL, web server will either be Apache or xgnix
How best to go about this?
You could take a look at high-performance NoSQL database solutions for this problem.
Redis, for example, is a in-memory key-value store with very high performance. You can adjust persisting the records to the disk according to you needs.