Sales Rank

A large eCommerce company wishes to list the best-selling products, overall and by category. For example, one product might be the #1056th best-selling product overall but th #13th best-selling product under Sports Equipment and the #24th best-selling product under Safety. Describe how you would design the system

Solution

Assume that each product can be in multiple categories, and there is no concept of subcategories.

we do not have to update in the real-time, hourly based / daily

cache, reduce the amounts of operations on Database