Github user MLnick commented on the issue:

    https://github.com/apache/spark/pull/18748
  
    Ok, so I did some larger-scale test on a cluster (3x workers, each with 48 
cores / 100GB allocated RAM with 1 executor).
    
    On same `movielens-latest` datasets (~250,000 users and ~33,000 movies), 
using a **30% sample** of user ids:
    
    ```
    scala> // all users
    scala> spark.time { model.recommendForAllUsers(k).foreach(_ => Unit) }
    Time taken: 25104 ms
    
    scala> // user sample
    scala> spark.time { model.recommendForUserSubset(userSample, k).foreach(_ 
=> Unit) }
    Time taken: 8963 ms
    
    scala> 8963 / 25104.0
    res16: Double = 0.35703473550031867
    ```
    
    On a much larger dataset - Amazon books ratings data (8 million users, 2.3 
million items) also using a **30% user sample**:
    
    ```
    scala> // all users
    scala> spark.time { model.recommendForAllUsers(k).foreach(_ => Unit) }
    Time taken: 32985936 ms
    => 9.16 hours
    
    scala> // user sample
    scala> spark.time { model.recommendForUserSubset(userSample, k).foreach(_ 
=> Unit) }
    Time taken: 8164421 ms
    => 2.26 hours
    
    scala> 8164421 / 32985936.0
    res7: Double = 0.24751218216151272
    ```
    
    So it's a reasonably consistent range *25-35%* of time for a *30%* user 
sample (I found broadly similar results with a 70% user sample, taking about 
60% of the recommend-for-all time).
    
    @mpjlu could you double check your results? What I find is consistent with 
my expectations that computing for a subset should take time roughly 
proportional to the ratio of the ids in the subset to the total. It appears to 
me the extra  `distinct` and `join` don't have too much impact on overall 
runtime.
    
    However your results are very different so we should understand why.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to