How to achieve random recommendation based on each person without repeated recommendations

Source: Internet
Author: User
System recommendation algorithm: according to the rules of each person, random recommendation is required, and each recommendation is different. How can this problem be achieved? Redis, mysql? System recommendation algorithm:
According to the rules of each person, random recommendation is required, and each recommendation is different. How can this problem be achieved?
Redis, mysql?

Reply content:

System recommendation algorithm:
According to the rules of each person, random recommendation is required, and each recommendation is different. How can this problem be achieved?
Redis, mysql?

We recommend that you use Redis to Mark recommended items with hash-type key-value. The next recommendation result will be compared in Redis. If not, the recommendation result will pass and be marked.

The Hash performance is much higher than that of SQL retrieval. Therefore, when we select Redis, the request time can be reduced to a single digit in ms and deployed to a dedicated Redis server without occupying the mysql load. The best choice is currently.

Of course redis preferred

It is not clear about your specific use cases. We suggest using this method.
You can use the redis set to randomly obtain your recommendation from the set.
Then, remove the retrieved data from the set to avoid repeated recommendations.

If it is not a massive amount of data, you can design a structure to achieve the functions you need:
A recommender and a table with recommended relationships,
Required: recommender, recommendation id

Random recommendation is not a problem. Create an algorithm by yourself (find the replacement algorithm of order by rand) it is good to find the recommendation that satisfies the number of items-it is nothing more than to exclude the previous recommendation (there are already table records ).

Therefore, you only need to record the id of the person who found the personal recommendation last time.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.