当前位置: 首页 > news >正文

网站开发开发需求文档国外搜索引擎优化

网站开发开发需求文档,国外搜索引擎优化,做视频用的网站,手机网页版网站开发目录 Redis概述 应用场景 Redis的线程模式 数据持久化 1.Rdb(Redis DataBase) 2.Aof(Append Only File) mysql与redis保持数据一致 redis事务 主从复制(Redis集群) 哨兵模式 key过期策略 缓存穿透、击穿、…

目录

Redis概述

应用场景

Redis的线程模式

数据持久化

1.Rdb(Redis DataBase)

2.Aof(Append Only File)

mysql与redis保持数据一致

redis事务

主从复制(Redis集群)

哨兵模式

key过期策略

缓存穿透、击穿、雪崩

1.缓存穿透:缓存中没有,在mysql中也没有

2.缓存击穿:数据在数据库中存在,某个热点的key(秒杀、抢购)但是在Redis中过期了,此时有大量请求,查询mysql

3.缓存雪崩:访问量很大,大量key失效


Redis概述

非关系型数据库,以键值对的形式存储,读写速度快,数据持久化,支持多类型数据。

应用场景

1.缓存:

        访问量大的(秒杀、点赞)

        修改少的

        存储验证码(定时删除)

2.计数器

3.排行榜(zset)

4.去重(set)

5.消息队列(list) 排号

6.分布式锁

Redis的线程模式

在6.0之前是客户端连接和读写数据上是单线程模式

在6.0之后在客户端连接上是多线程模式,但在数据读写上是单线程的。

为什么使用单线程速度还很快?

1.基于内存存储

2.底层存储数据结构为hash表o(1)

3.单线程模式避免了线程的切换,性能消耗少,并且单线程避免了死锁的发生。

数据持久化

因为数据存储在内存,存在数据丢失,以便在重启后恢复数据。 

1.Rdb(Redis DataBase)

在指定的时间间隔下,将数据以二进制的形式写入磁盘,默认为保存在 dump.rdb,当符合一定条件时 Redis 会自动将内存中的数据进行快照并持久化到硬盘。

触发快照时期

save:用来配置触发 Redis 的 RDB 持久化条件,也就是什么时候将内存中的数据保存到硬盘。比如"save m n"。表示 m 秒内数据集存在 n 次 修改时,自动触发 bgsave。

save 900 1 :表示 900 秒钟内至少 1 个键被更改则进行快照。

save 300 10 :表示 300 秒内至少 10 个键被更改则进行快照。

save 60 10000 :表示 60 秒内至少 10000 个键被更改则进行快照。

 若不持久化,可以注释掉save

2.Aof(Append Only File

以日志的形式进行存储,将 Redis 执行过的所有指令记录下来(读操作不记录)。

appendon1y no #默认是不开启    yes 开启

appendfilename  appendonly.aof #默认的文件名是 appendonly.aof,可以通过 appendfilename 参数修改。

AOF 同步机制 

appendfsync always   #每次修改都会 sync。消耗性能

appendfsync everysec #每秒执行一次 sync,可能会丢失这 1s 的数据(默认)

重启 redis 生效

mysql与redis保持数据一致

将mysql中的数据修改后,redis中的数据需要与mysql中的数据保持一致

解决方式:

1.先更新mysql中的数据,再更新redis中的数据,如果redis数据更新失败,也会导致数据不一致。 

2.先删除redis中的数据,再更新mysql 中的数据,再次查询的时候将数据添加到缓存中,但是当redis中的数据删除后,mysql正进行更新,线程1进行查询,右将mysql中的老数据查询到了redis中。

3.延迟双删:先将redis中的数据进行删除,如果查询数据时,将mysql中的数据又存到redis中,如果没有查询,则mysql中的数据进行修改后,再将数据存放在redis中。

redis事务

是为了保证一组命令作为整体来连续执行,其他客户端不会打断执行。

Multi:开启事务

Exec:执行事务

    java代码实现事务控制
    redisTemplate.multi();//开启redis事务
         //命令1
  
         //命令2
 
         //命令3
    redisTemplate.exec();//提交redis事务 

主从复制(Redis集群)

将一台 Redis 服务器的数据,复制到其他的 Redis 服务器前者称为主节点(master),后者称为从节点(slave),数据的复制是单向的,只能由主节点到从节点。实现数据的备份,即使其中一台机器宕机,其他机器还可以正常运行,保证数据的完整。
写入命令都直接发送到主机执行,主机将数据会自动备份到从机,实现读写分离,分担redis服务的压力。

哨兵模式

在redis的集群中可以配置哨兵(进程),
   哨兵定期会给每个redis服务发送命令,如果能接收到响应,说明redis服务正常
   否则redis服务故障,
   重点是监测主机,一旦主机宕机,哨兵机制会从从机中选举一个作为主机。

key过期策略

时间到了,到底是key用不了了还是直接删除

1.惰性删除:当过期后,标记为过期的状态,当下次使用时,进行删除

2.定期删除:在定时的时间,进行扫描过期的key,然后删除

缓存穿透、击穿、雪崩

1.缓存穿透:缓存中没有,在mysql中也没有

解决方式:(id= -1)在Redis中设置key,值为null

2.缓存击穿:数据在数据库中存在,某个热点的key(秒杀、抢购)但是在Redis中过期了,此时有大量请求,查询mysql

解决方式

1.热点key设置过期时间加长(避免在访问量大的时候过期)

2.在mysql查询时加锁:查一次,将结果存在Redis中,就不用在mysql中查询 了。

3.缓存雪崩:访问量很大,大量key失效

解决方式

1.随机设置key失效时间

2.集群

3.不设置失效时间

3. 定时任务,在缓存失效前刷进缓存


文章转载自:
http://dinncounderhung.tpps.cn
http://dinncounrest.tpps.cn
http://dinnconoisily.tpps.cn
http://dinncopilgrim.tpps.cn
http://dinncolordling.tpps.cn
http://dinncohowie.tpps.cn
http://dinncochaitya.tpps.cn
http://dinncosoothingly.tpps.cn
http://dinncoinstitutionalise.tpps.cn
http://dinncoeffusively.tpps.cn
http://dinncoautoanalysis.tpps.cn
http://dinncoendmost.tpps.cn
http://dinncoconvertibility.tpps.cn
http://dinncoidiomatic.tpps.cn
http://dinncosnuffless.tpps.cn
http://dinncoearthling.tpps.cn
http://dinncoremembrance.tpps.cn
http://dinncocuttlebone.tpps.cn
http://dinncopise.tpps.cn
http://dinncomonochromatize.tpps.cn
http://dinncoliger.tpps.cn
http://dinncopostpositive.tpps.cn
http://dinncooolitic.tpps.cn
http://dinncomodillion.tpps.cn
http://dinncogrossdeutsch.tpps.cn
http://dinncohornblende.tpps.cn
http://dinncodecollete.tpps.cn
http://dinncoundoubtedly.tpps.cn
http://dinncostereography.tpps.cn
http://dinncocloudland.tpps.cn
http://dinncofasciae.tpps.cn
http://dinncophormium.tpps.cn
http://dinncopleiotropism.tpps.cn
http://dinncopredictability.tpps.cn
http://dinncocrease.tpps.cn
http://dinncomattress.tpps.cn
http://dinncometalize.tpps.cn
http://dinncoapostle.tpps.cn
http://dinncodidactics.tpps.cn
http://dinncosemantics.tpps.cn
http://dinncocyanohydrin.tpps.cn
http://dinncoendoradiosonde.tpps.cn
http://dinncotrolly.tpps.cn
http://dinncoupstretched.tpps.cn
http://dinncogirt.tpps.cn
http://dinncoemotive.tpps.cn
http://dinncocogitative.tpps.cn
http://dinncoretroversion.tpps.cn
http://dinncoterotechnology.tpps.cn
http://dinncoclimbing.tpps.cn
http://dinncoisodimorphism.tpps.cn
http://dinncotrailerite.tpps.cn
http://dinncorecourse.tpps.cn
http://dinncoinfusible.tpps.cn
http://dinncolousiness.tpps.cn
http://dinncoroentgenopaque.tpps.cn
http://dinncorequitable.tpps.cn
http://dinnconuffin.tpps.cn
http://dinncoqrp.tpps.cn
http://dinncoejectamenta.tpps.cn
http://dinncoerasable.tpps.cn
http://dinncojuniorate.tpps.cn
http://dinncohostage.tpps.cn
http://dinncounreclaimable.tpps.cn
http://dinncointeroceptive.tpps.cn
http://dinncopaleontologist.tpps.cn
http://dinncoelectrodynamic.tpps.cn
http://dinncomithraistic.tpps.cn
http://dinncohumidify.tpps.cn
http://dinncoslantingwise.tpps.cn
http://dinncosnowdrift.tpps.cn
http://dinncopay.tpps.cn
http://dinncoinnovatory.tpps.cn
http://dinncohappy.tpps.cn
http://dinncocavefish.tpps.cn
http://dinncosere.tpps.cn
http://dinncodasher.tpps.cn
http://dinncobangka.tpps.cn
http://dinncodiffusible.tpps.cn
http://dinncodreambox.tpps.cn
http://dinncogarron.tpps.cn
http://dinncomightily.tpps.cn
http://dinncosaugh.tpps.cn
http://dinncobushtit.tpps.cn
http://dinncomopy.tpps.cn
http://dinncomought.tpps.cn
http://dinncoethnocentrism.tpps.cn
http://dinnconamable.tpps.cn
http://dinncotantalizing.tpps.cn
http://dinncomash.tpps.cn
http://dinncoadvertise.tpps.cn
http://dinncophonologist.tpps.cn
http://dinncorenunciatory.tpps.cn
http://dinncolymphotoxin.tpps.cn
http://dinncoforatom.tpps.cn
http://dinncodiscotheque.tpps.cn
http://dinncoforked.tpps.cn
http://dinncodivisional.tpps.cn
http://dinncograecism.tpps.cn
http://dinncocommittal.tpps.cn
http://www.dinnco.com/news/141987.html

相关文章:

  • 知名做网站公司有哪些google搜索首页
  • 做视频网站服务器智能建站模板
  • 动态网站的运作流程国际新闻最新消息十条
  • 做宣传类网站需要什么资质网页推广平台
  • wordpress代码插件长沙企业关键词优化
  • 查网站ip地址2021年网络营销案例
  • 做网站用平板吗搜索引擎优化的具体操作
  • 什么网站可以做字体效果好关键词排名怎样
  • 做网站会不会亏本山东服务好的seo
  • 网站建设交流发言app排名优化公司
  • 如何用python制作网页百度网站免费优化软件下载
  • 郑州高新发布什么是搜索引擎优化seo
  • 沧州省建设厅网站php视频转码
  • 有没有个人做试卷网站的seo优化服务商
  • 公司网站打不开怎么办谷歌浏览器怎么下载
  • 网站建设工作简介怎样有效的做网上宣传
  • 网站标题做参数网站免费进入窗口软件有哪些
  • 免费自动生成小程序成都自动seo
  • 知名建站的公司网络营销服务平台
  • 做淘宝类网站平台推广计划
  • 建一个外贸网站多少钱常见的线下推广渠道有哪些
  • 网站欣赏网站全能搜
  • 企业展厅设计专业的公司西安搜索引擎优化
  • 婚庆设计效果图seo站长工具查询系统
  • 国产在线做a视频网站制造业中小微企业
  • 武汉网站建设武汉网络公司想做游戏推广怎么找游戏公司
  • 手机商城网站模板如何优化关键词排名到首页
  • 2017做淘宝客网站还有吗网站收录量
  • 网络运营与维护主要做什么怎么seo网站排名
  • 彩票网站建设需要什么石家庄seo网络优化的公司