基于Kafka和Redis的商城限时秒杀商品系统的设计与实现

 2022-04-09 09:04

论文总字数:24949字

摘 要

随着计算机技术的迅速发展,加之政府、高校和业界各组织的支持推动下,我国的电子商务开始了急剧的发展和增长。在刺激网上用户消费的方式中,限时秒杀作为电商中比较成熟的玩法,是重要的促销手段之一,这有助于丰富商城形式,带动商城实物销量增长。

由于秒杀系统实时并发请求量较大、商品数据量多,以及业务的错综复杂,这些都对数据一致性的维持和延迟时间的控制都是系统设计的难点。作为电商系统,对其后期维护性与业务可拓展性、系统的可靠性也提出了较高的要求。

本文以小黑鱼科技公司商城部门的商品秒杀系统的设计与开发为例,首先介绍该系统的开发背景与该系统开发所需要解决的问题与难点。其次针对各个难点所使用的技术进行介绍,包括开源项目框架SSM、消息传递Kafka、用于实时缓存的Redis、分布式ZooKeeper,以及小黑鱼公司独有技术,包括Fsp、Fdg和Fts。再者本文介绍整体系统框架设计,结合各个技术剖析各层详细设计。最后我们搭建测试系统,对搭建好的系统进行压力测试测试综合性能数据。

测试结果证明本次系统设计,有效控制了业务数据不一致问题,解决了用户秒杀购物时高延迟问题,使系统具有较高可靠性。

关键词:秒杀系统,数据一致性,并发请求量,Kafka,Redis

ABSTRACT

With the rapid development of information technology and the support of the government, universities and information organizations, China's e-commerce has developed rapidly. In the way of stimulating online users' consumption, timed seckill, as a mature method of playing in e-commerce, is one of the important means of promotion, which helps to enrich the forms of online shopping and drive the growth of physical sales in shopping malls.

Due to the large number of real-time concurrent requests, large amount of commodity data, and the complexity of business, the maintenance of data consistency and the control of delay time are the difficulties in the system design. As an e-commerce system, it also puts forward higher requirements on its maintenance, business expansibility and system reliability.

This paper takes the design and development of the commodity seckill system of the mall department of Black Fish Technology Company as an example, and first introduces the development background of the system and the problems and difficulties to be solved in the development of the system. Secondly, the technologies used in various difficulties are introduced, including the open source project framework SSM, messaging Kafka, Redis for real-time cache, distributed ZooKeeper, and the unique technologies of Black Fish, including Fsp, Fdg and Fts. Moreover this article introduces the whole system frame design, unifies each technical analysis each layer detailed design. Finally, we set up the test system and conducted pressure test on the built system to test the comprehensive performance data.

Test results show that this system design reduces the probability of inconsistent business data, solves the problem of high delay when the users rush to shopping, and makes the system have higher reliability.

KEY WORDS: seckill system,data consistency,concurrent requests,Kafka,Redis

目 录

摘要 I

ABSTRACT II

第一章 绪论 1

1.1 选题及意义 1

1.2 现状 1

1.3 论文组织结构 2

第二章 开发背景 4

2.1 需求背景 4

2.2 需求说明 4

2.2.1 限时秒杀列表 4

2.2.2 限时秒杀商品详情页 5

2.2.3 base后台管理系统 8

2.2.4 其他业务需求 9

2.3 需求规定 9

2.4 系统难点 10

2.4.1 框架选择与设计 10

2.4.2 存储限制 10

2.4.3 访存延迟 11

2.4.4 业务正确性 11

2.4.5 数据一致性 12

2.4.6 开发过程管理 12

第三章 技术综述 13

3.1 Spring springMVC mybatis 13

3.1.1 Spring 13

3.1.2 SpringMVC 14

3.1.3 Mybatis 14

3.2 Kafka 15

3.2.1 Kafka概述 15

3.2.2 Kafka工作原理[2] 15

3.2.3 Kafka处理消息传递的优势 16

3.3 Redis 16

3.3.1 Redis概述 16

3.3.2 Redis特点及优势[3] 16

3.4 Zookeeper 17

3.4.1 Zookeeper概述 17

3.4.2 Zookeeper运行原理[7] 17

3.4.3 Zookeeper处理分布式的优势 17

3.5 FSP服务治理框架 18

3.5.1 什么是FSP 18

3.5.2 FSP整体架构 18

3.5.3 FSP设计说明 19

3.6 Fdg数据源管理 20

3.6.1 什么是FDG 20

3.6.2 FDG总体框架 20

第四章 软件结构设计 23

4.1 软件过程设计 23

4.2 需求业务功能设计 24

4.3 详细流程设计 24

4.3.1 用户流程设计 24

4.3.2 业务流程设计 25

4.3.3 同级系统交互设计 27

4.4 实体与数据库设计 28

4.5 业务分层设计 30

4.5.1 控制层 30

4.5.2 应用层设计 30

4.5.3 数据层设计 32

4.6 项目接口测试设计 32

第五章 系统实现与测试结果 34

5.1 系统实现展示 34

5.1.1 Base后台 34

5.1.2 Mskp系统 36

5.2 系统测试 39

5.2.1 测试环境准备 39

5.2.2 测试过程及结果分析 39

第六章 总结及展望 42

参考文献 43

致谢 44

绪论

选题及意义

在互联网时代,移动终端渗透我们生活的各个领域,人们试图将生活中琐碎繁杂的事情用手机来解决,包括购物、订车票机票、刷卡支付等等,这些都大大便利了我们的生活,加快了生活节奏。电商指以计算机和信息技术为手段,以商务为核心,将以实体为核心的销售、购物方式移到网上来,这有利于减少地域和时间的约束,使得商品销售达到全球化和一体化,而且能刺激个体的个性化。

剩余内容已隐藏,请支付后下载全文,论文总字数:24949字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;