知行合一

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 35 下一页

2021年3月27日 #

摘要: 一、如何正确使用数据库读写分离 1、背景 在应用系统发展的初期,我们并不知道以后会发展成什么样的规模,所以一开始不会考虑复杂的系统架构,复杂的系统架构费时费力,开发周期长,与系统发展初期这样的一个定位是不吻合的。所以,我们都会采用简单的架构,随着业务不断的发展,访问量不断升高,我们再对系统进行架构方 阅读全文
posted @ 2021-03-27 19:06 callbin 阅读(1061) 评论(0) 推荐(0) 编辑

摘要: 一、海量数据的存储与访问瓶颈解决方案-数据切分 1、背景 在当今这个时代,人们对互联网的依赖程度非常高,也因此产生了大量的数据,企业视这些数据为瑰宝。而这些被视为瑰宝的数据为我们的系统带来了很大的烦恼。这些海量数据的存储与访问成为了系统设计与使用的瓶颈,而这些数据往往存储在数据库中,传统的数据库存在 阅读全文
posted @ 2021-03-27 14:11 callbin 阅读(239) 评论(0) 推荐(0) 编辑

摘要: 一、多种分布式锁实现方案,我将如何选择? 二、在电商落地--扣减库存 1.扣减库存对应的数据库sql update行锁,串行。大量请求数据库压力大 2、pom引入依赖 3、实例化 4、扣减库存方法修改。通过锁机制,数据库压力减轻。 阅读全文
posted @ 2021-03-27 09:16 callbin 阅读(174) 评论(0) 推荐(0) 编辑

摘要: 基于redisson实现分布式锁 一、上官网 https://redisson.org/ 二、pom文件引入依赖 <dependency> <groupId>org.redisson</groupId> <artifactId>redisson</artifactId> <version>3.11. 阅读全文
posted @ 2021-03-27 08:43 callbin 阅读(150) 评论(0) 推荐(0) 编辑

摘要: 基于Zookeeper的curator客户端实现分布式锁 一、进入官网 http://curator.apache.org 二、引入curator 的jar包 1、进入 https://mvnrepository.com/ 搜索 curator 2.Pom文件引入找到的jar包依赖 <depende 阅读全文
posted @ 2021-03-27 07:58 callbin 阅读(85) 评论(0) 推荐(0) 编辑

2021年3月26日 #

摘要: 1、Zookeeper的数据结构 二、zookeeper分布式锁原理 二、zookeeper分布式锁代码实现 1、maven依赖 (1)https://mvnrepository.com/ 搜索 zookeeper (2)选择安装的对应版本 (3) pom 文件 添加依赖 <dependency> 阅读全文
posted @ 2021-03-26 20:00 callbin 阅读(131) 评论(0) 推荐(0) 编辑

摘要: 一、基于分布式锁解决定时任务重复问题 1、定时任务部署集群 二、利用redis分布式锁解决定时任务重复发送短信 1、启用定时任务 package com.example.distributelock; import org.mybatis.spring.annotation.MapperScan; 阅读全文
posted @ 2021-03-26 19:32 callbin 阅读(796) 评论(0) 推荐(0) 编辑

摘要: 一、 redis分布式锁原理 并发 到Redis里变成了串行排队,单线程 二、基于Redis的Setnx实现分布式锁 1、pom <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-star 阅读全文
posted @ 2021-03-26 11:23 callbin 阅读(2174) 评论(0) 推荐(2) 编辑

摘要: 一、基于数据库悲观锁的分布式锁 代码 package com.example.distributelock.controller; import com.example.distributelock.dao.DistributeLockMapper; import com.example.distr 阅读全文
posted @ 2021-03-26 09:02 callbin 阅读(63) 评论(0) 推荐(0) 编辑

摘要: 一、如何使用锁解决电商中的超卖的问题? 1、模拟5个线程并发执行。使用CyclicBarrier类 package com.example.distributedemo; import com.example.distributedemo.service.OrderService; import o 阅读全文
posted @ 2021-03-26 07:33 callbin 阅读(100) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 35 下一页