All Projects → MoriatyBug → Flink Commodity Recommendation System

MoriatyBug / Flink Commodity Recommendation System

🐳基于 Flink 的商品实时推荐系统。使用了 redis 缓存热点数据。当用户产生评分行为时,数据由 kafka 发送到 flink,根据用户历史评分行为进行实时和离线推荐。实时推荐包括:基于行为和实时热门,离线推荐包括:历史热门、历史优质商品和 itemcf 。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Flink Commodity Recommendation System

Flinkstreamsql
基于开源的flink,对其实时sql进行扩展;主要实现了流与维表的join,支持原生flink SQL所有的语法
Stars: ✭ 1,682 (+907.19%)
Mutual labels:  flink
Deepconn
This is our implementation of DeepCoNN
Stars: ✭ 131 (-21.56%)
Mutual labels:  recommendation-system
Artificial Intelligence Projects
Collection of Artificial Intelligence projects.
Stars: ✭ 152 (-8.98%)
Mutual labels:  recommendation-system
Waterdrop
Production Ready Data Integration Product, documentation:
Stars: ✭ 1,856 (+1011.38%)
Mutual labels:  flink
Hadoopcryptoledger
Hadoop Crypto Ledger - Analyzing CryptoLedgers, such as Bitcoin Blockchain, on Big Data platforms, such as Hadoop/Spark/Flink/Hive
Stars: ✭ 126 (-24.55%)
Mutual labels:  flink
Ecommercerecommendsystem
商品大数据实时推荐系统。前端:Vue + TypeScript + ElementUI,后端 Spring + Spark
Stars: ✭ 139 (-16.77%)
Mutual labels:  flink
Movielens Recommender System Javascript
🍃 Recommender System in JavaScript for the MovieLens Database
Stars: ✭ 105 (-37.13%)
Mutual labels:  recommendation-system
Flink Clickhouse Sink
Flink sink for Clickhouse
Stars: ✭ 165 (-1.2%)
Mutual labels:  flink
Ajax Movie Recommendation System With Sentiment Analysis
Content-Based Recommender System recommends movies similar to the movie user likes and analyses the sentiments on the reviews given by the user for that movie.
Stars: ✭ 127 (-23.95%)
Mutual labels:  recommendation-system
Streamline
StreamLine - Streaming Analytics
Stars: ✭ 151 (-9.58%)
Mutual labels:  flink
Neural Attentive Item Similarity Model
TensorFlow Implementation of Neural Attentive Item Similarity Model for Recommendation on TKDE 2018
Stars: ✭ 118 (-29.34%)
Mutual labels:  recommendation-system
Pulsar Flink
Elastic data processing with Apache Pulsar and Apache Flink
Stars: ✭ 126 (-24.55%)
Mutual labels:  flink
Graphembeddingrecommendationsystem
Python based Graph Propagation algorithm, DeepWalk to evaluate and compare preference propagation algorithms in heterogeneous information networks from user item relation ship.
Stars: ✭ 144 (-13.77%)
Mutual labels:  recommendation-system
Java learning practice
java 进阶之路:面试高频算法、akka、多线程、NIO、Netty、SpringBoot、Spark&&Flink 等
Stars: ✭ 110 (-34.13%)
Mutual labels:  flink
Big Whale
Spark、Flink等离线任务的调度以及实时任务的监控
Stars: ✭ 163 (-2.4%)
Mutual labels:  flink
Flink Learning
flink learning blog. http://www.54tianzhisheng.cn/ 含 Flink 入门、概念、原理、实战、性能调优、源码解析等内容。涉及 Flink Connector、Metrics、Library、DataStream API、Table API & SQL 等内容的学习案例,还有 Flink 落地应用的大型项目案例(PVUV、日志存储、百亿数据实时去重、监控告警)分享。欢迎大家支持我的专栏《大数据实时计算引擎 Flink 实战与性能优化》
Stars: ✭ 11,378 (+6713.17%)
Mutual labels:  flink
Quicksql
A Flexible, Fast, Federated(3F) SQL Analysis Middleware for Multiple Data Sources
Stars: ✭ 1,821 (+990.42%)
Mutual labels:  flink
Flinkx
Based on Apache Flink. support data synchronization/integration and streaming SQL computation.
Stars: ✭ 2,651 (+1487.43%)
Mutual labels:  flink
Newsrecommender
A news recommendation system tailored for user communities
Stars: ✭ 164 (-1.8%)
Mutual labels:  recommendation-system
Rival
RiVal recommender system evaluation toolkit
Stars: ✭ 145 (-13.17%)
Mutual labels:  recommendation-system

FlinkCommodityRecommendationSystem

Recs FlinkCommodityRecommendationSystem(基于 Flink 的商品推荐系统)

1. 前言

系统取名为 Recs,灵感源于 Recommendation System。logo 使用在线 logo 网站制作。 作者开发该项目,是为了学习 Flink 以及相关大数据中间件。出于展示目的,使用 Springboot + Vue 开发了配套的 web。 作者有过 python + django + JavaScript 的 web 开发的经历,考虑到项目使用 java 开发,为了技术栈的统一,现学了 Springboot 框架以及 Vue。

本项目借鉴了 ECommerceRecommendSystem 开源学习项目,前端部分借鉴较多,在作者搭建好的框架基础上进行优化。修改了 ui 以及部分 bug,并且新增部分功能。 经过本项目的开发锻炼,作者对大数据相关的技术有了较为系统的理解,收获较大。在开发过程中,遇到过很多问题,但都逐一攻克了。作者的经验是,解决问题最好的办法就是阅读官方文档和积极使用 Google。 最后,相关的技术都是现学现用,知识比较片面,因此本项目存在很多待优化的地方,欢迎大家 issue,一起学习,一起进步。

2. 项目简介

2.1 Recs 系统架构

system_architecture.png

系统主要工作流程:

  • 用户登录/注册系统。

  • 用户对商品进行评分。

  • 评分数据通过 Kafka 发送到推荐模块的实时推荐任务中。

  • 系统执行实时推荐任务,并且将数据存储到 hbase 的 rating 和 userProduct 表中。实时任务包括:实时 topN 以及 基于用户行为推荐。

  • 实时 topN 将计算结果存储到 hbase 的 onlineHot 表中,基于用户行为推荐将计算结果存储到 hbase 的表 onlineRecommend 中。

  • web 端通过查询 hbase 获取相关模块所需数据并展示结果。

2.2 首页

index.png

共有四个模块:

  • 猜你喜欢:基于用户行为推荐,当用户对商品进行评分时,Flink 根据用户历史评分商品,结合 itemCF 计算推荐结果。
  • 热门商品:历史热门商品
  • 好评商品:评分较高的商品
  • 实时热门商品: 使用 Flink 时间滑动窗口,对过去一个小时热门商品进行统计,每 5 分钟滑动一次。

2.3 商品详情

product_info.png

  • 展示商品详细信息

  • 看过该商品的人还看了:基于 itemCF 进行推荐

2.4 登录

login.png

3. 模块说明

3.1 推荐模块 (recommendation)

开发环境: IDEA + Maven + git + windows && wsl

**软件架构:**flink + hbase + kafka + mysql + redis

开发指导: flink 的计算任务都存放在 task 包下,DataLoader 为加载数据任务,OfflineRecommender 为离线推荐任务, OnlineRecommender 为实时推荐任务。以模块为单位阅读代码。

3.1.1 猜你喜欢

实时推荐:

  • 从 redist 中查询用户最近评分商品列表 , redis key 为 “ONLINE_PREFIX_” + userId
  • 从 hbase 表 userProduct 中查询用户历史评分商品列表。
  • 根据用户刚评分的 productId 从 hbase 表 itemCFRecommend 表中查询相关的商品列表
  • 对相关商品列表根据之前查出的最近评分商品列表和历史评分商品列表过滤。
  • 根据最近评分商品与本次商品的相似度以及用户历史评分对推荐商品重新排序。

3.1.2 热门商品

对所有时间用户评分的商品根据评分次数进行逆序排序,选出热门商品。

  • flink 将 hbase rating 表加载到内存中,根据 productId group,并且统计出现次数
  • 根据出现次数逆序排序。

3.1.3 好评商品

根据商品评分均分逆序排序,

3.1.4 实时热门商品

采用 flink timeWindow 对过去一个小时的数据进行排序,选出热门的商品。时间窗口每五分钟滑动一次。

3.1.5 看过该商品的人还看了

基于物品推荐 (itemCF)

3.1.6 数据装载模块

消费 kafka topic 为 rating 的数据,并且将数据存储到 hbase rating 表中,为了保证数据的唯一性rowKey 格式为:

userId_productId_timestamp

3.2 后端 (recommend_backend)

开发环境: IDEA + Maven + git + windows && wsl(ubuntu 20.4)+ postwomen

技术架构: Springboot + hibernate + mysql + hbase

开发指导: Controller 模块是后端的核心,从 restFul api 入手。

项目架构:

backend.png

3.3 前端 (recommend_front)

开发环境: VScode + nodejs + windows && wsl

技术架构: Vue + typescript + element-ui

4. 开发运行步骤

4.1 环境搭建

  • mysql
  • hbase
  • flink
  • redis
  • kafka
  • zookeeper

4.2 创建数据表

  • mysql

共有两张表,一个是 product 用于存储商品的详细信息,另一个是 user 用于存储用户信息。

建表 sql 脚本在 recommendation/src/main/resources/mysql.sql

  • hbase

    • rating
    • userProduct
    • itemCFRecommend
    • goodProducts
    • historyHotProducts
    • onlineRecommend
    • onlineHot

建表语句在 recommendation/src/main/resources/hbase.txt

4.3 数据入库

商品信息存储在recommendation/src/main/resources/product.csv 文件里,我们运行一个 flink 任务将数据装载到 mysql 中。对应的表是我们之前创建的 product

  • 启动 flink ,运行 recommendation/.../task/DataLoader/DataLoaderTask.java
  • 商品信息存储到 mysql 中

4.4 启动开发环境

  • 执行启动脚本

启动脚本是为了一键启动之前部署的 hbase、kafka、flink、redis、zookeeper 等

为了方便开发,作者写了启动和停止环境的 shell 脚本,在recommendation/main/resources 目录下,分别为 startAll.sh 和 stopAll.sh

  • 启动 springboot 后端项目
  • 启动 vue 前端
  • 启动实时推荐任务
  • 离线任务定时启动

5. todo

  • [ ] 完善开发文档
    • [ ] 详细模块说明
    • [ ] 模块部署流程
    • [ ] 算法原理
  • [ ] 制作 docker 部署项目

最后,作者正在经历2021秋招,如果您觉得本项目不错,欢迎给个 star!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].