It seems you are on the right track - a few suggestions -
For intensive computing, you probably want to cache your results, so you only get the top “x” number, which is updated once a day or similar to this effect. In this case, the real time does not seem significant.
I'm not sure what products you have on your site, but if the variety is significant, you might want to put items that have related information in order to display (so Star Wars only had Star Wars related items popping up).
So, if you have “tags” for your products or keywords, you can use relationships with them.
You may also want to create weight by how they got to the product. If they got to the product by clicking on the list that you provided, then these types of items will continue to fill up and not give other products a chance to appear, so give it a little weight. Instead, heavier elements will appear.
source share