[Refactor] Replaced reduceByKey with countByKey for performance tuning