全民快乐8

你当前所在位置:全民快乐8 > IT就业问题 > Java面试题及答案(18/19)——Redis

Java面试题及答案(18/19)——Redis

179. redis 是什么?都有哪些使用场景?

 

RedisSHIYIGEKAIYUANDESHIYONGANSI CYUYANBIANXIE、ZHICHIWANGLUO、KEJIYUNEICUNYIKECHIJIUHUADERIZHIXING、Key-ValueSHUJUKU,BINGTIGONGDUOZHONGYUYANDEAPI。

 

Redis SHIYONGCHANGJING:

 

全民快乐8● SHUJUGAOBINGFADEDUXIE

● HAILIANGSHUJUDEDUXIE

全民快乐8● DUIKUOZHANXINGYAOQIUGAODESHUJU

 

180. redis 有哪些功能?

 

● SHUJUHUANCUNGONGNENG

● FENBUSHISUODEGONGNENG

全民快乐8● ZHICHISHUJUCHIJIUHUA

全民快乐8● ZHICHISHIWU

● ZHICHIXIAOXIDUILIE

 

181. redis 和 memecache 有什么区别?

 

全民快乐8● memcachedSUOYOUDEZHIJUNSHIJIANDANDEZIFUCHUAN,redisZUOWEIQITIDAIZHE,ZHICHIGENGWEIFENGFUDESHUJULEIXING

全民快乐8● redisDESUDUBImemcachedKUAIHENDUO

全民快乐8● redisKEYICHIJIUHUAQISHUJU

 

182. redis 为什么是单线程的?

 

YINWEI cpu BUSHI Redis DEPINGJING,Redis DEPINGJINGZUIYOUKENENGSHIJIQINEICUNHUOZHEWANGLUODAIKUAN。JIRANDANXIANCHENGRONGYISHIXIAN,ERQIE cpu YOUBUHUICHENGWEIPINGJING,NEIJIUSHUNLICHENGZHANGDICAIYONGDANXIANCHENGDEFANGANLE。

 

全民快乐8GUANYU Redis DEXINGNENG,GUANFANGWANGZHANYEYOU,PUTONGBIJIBENQINGSONGCHULIMEIMIAOJISHIWANDEQINGQIU。

 

ERQIEDANXIANCHENGBINGBUDAIBIAOJIUMAN nginx HE nodejs YEDOUSHIGAOXINGNENGDANXIANCHENGDEDAIBIAO。

 

183. 什么是缓存穿透?怎么解决?

 

全民快乐8HUANCUNCHUANTOU:ZHICHAXUNYIGEYIDINGBUCUNZAIDESHUJU,YOUYUHUANCUNSHIBUMINGZHONGSHIXUYAOCONGSHUJUKUCHAXUN,CHABUDAOSHUJUZEBUXIERUHUANCUN,ZHEIJIANGDAOZHIZHEIGEBUCUNZAIDESHUJUMEICIQINGQIUDOUYAODAOSHUJUKUQUCHAXUN,ZAOCHENGHUANCUNCHUANTOU。

 

JIEJUEFANGAN:ZUIJIANDANCUBAODEFANGFARUGUOYIGECHAXUNFANHUIDESHUJUWEIKONG(BUGUANSHISHUJUBUCUNZAI,HAISHIXITONGGUZHANG),WOMENJIUBAZHEIGEKONGJIEGUOJINXINGHUANCUN,DANTADEGUOQISHIJIANHUIHENDUAN,ZUIZHANGBUCHAOGUOWUFENZHONG。

 

184. redis 支持的数据类型有哪些?

 

string、list、hash、set、zset。

 

185. redis 支持的 java 客户端都有哪些?

 

全民快乐8Redisson、Jedis、lettuceDENGDENG,GUANFANGTUIJIANSHIYONGRedisson。

 

186. jedis 和 redisson 有哪些区别?

 

● JedisSHIRedisDEJavaSHIXIANDEKEHUDUAN,QIAPITIGONGLEBIJIAOQUANMIANDERedisMINGLINGDEZHICHI。

 

● RedissonSHIXIANLEFENBUSHIHEKEKUOZHANDEJavaSHUJUJIEGOU,HEJedisXIANGBI,GONGNENGJIAOWEIJIANDAN,BUZHICHIZIFUCHUANCAOZUO,BUZHICHIPAIXU、SHIWU、GUANDAO、FENQUDENGRedisTEXING。RedissonDEZONGZHISHICUJINSHIYONGZHEDUIRedisDEGUANZHUFENLI,CONGERRANGSHIYONGZHENENGGOUJIANGJINGLIGENGJIZHONGDIFANGZAICHULIYEWULUOJISHANG。

 

187. 怎么保证缓存和数据库数据的一致性?

 

全民快乐8● HELISHEZHIHUANCUNDEGUOQISHIJIAN。

● XINZENG、GENGGAI、SHANCHUSHUJUKUCAOZUOSHITONGBUGENGXIN Redis,KEYISHIYONGSHIWUJIZHILAIBAOZHENGSHUJUDEYIZHIXING。

 

全民快乐8188. redis CHIJIUHUAYOUJIZHONGFANGSHI?

 

Redis DECHIJIUHUAYOULIANGZHONGFANGSHI,HUOZHESHUOYOULIANGZHONGCELVE:

 

● RDB(Redis Database):ZHIDINGDESHIJIANJIANGENENGDUINIDESHUJUJINXINGKUAIZHAOCUNCHU。

● AOF(Append Only File):MEIYIGESHOUDAODEXIEMINGLINGDOUTONGGUOwriteHANSHUZHUIJIADAOWENJIANZHONG。

 

189. redis 怎么实现分布式锁?

 

Redis FENBUSHISUOQISHIJIUSHIZAIXITONGLIMIANZHANYIGE“KENG”,QITACHENGXUYEYAOZHAN“KENG”DESHIHOU,ZHANYONGCHENGGONGLEJIUKEYIJIXUZHIXING,SHIBAILEJIUZHINENGFANGQIHUOSHAOHOUZHONGSHI。

 

ZHANKENGYIBANSHIYONG setnx(set if not exists)ZHILING,ZHIYUNXUBEIYIGECHENGXUZHANYOU,SHIYONGWANDIAOYONG del SHIFANGSUO。

 

190. redis 分布式锁有什么缺陷?

 

全民快乐8Redis FENBUSHISUOBUNENGJIEJUECHAOSHIDEWENTI,FENBUSHISUOYOUYIGECHAOSHISHIJIAN,CHENGXUDEZHIXINGRUGUOCHAOCHULESUODECHAOSHISHIJIANJIUHUICHUXIANWENTI。

 

191. redis 如何做内存优化?

 

JINKENENGSHIYONGSANLIEBIAO(hashes),SANLIEBIAO(SHISHUOSANLIEBIAOLIMIANCUNCHUDESHUSHAO)SHIYONGDENEICUNFEICHANGXIAO,SUOYINIYINGGAIJINKENENGDEJIANGNIDESHUJUMOXINGCHOUXIANGDAOYIGESANLIEBIAOLIMIAN。

 

全民快乐8BIRUNIDEwebXITONGZHONGYOUYIGEYONGHUDUIXIANG,BUYAOWEIZHEIGEYONGHUDEMINGCHENG,XINGSHI,YOUXIANG,MIMASHEZHIDANDUDEkey,ERSHIYINGGAIBAZHEIGEYONGHUDESUOYOUXINXICUNCHUDAOYIZHANGSANLIEBIAOLIMIAN。

 

192. redis 淘汰策略有哪些?

 

● volatile-lru:CONGYISHEZHIGUOQISHIJIANDESHUJUJI(server. db[i]. expires)ZHONGTIAOXUANZUIJINZUISHAOSHIYONGDESHUJUTAOTAI。

全民快乐8● volatile-ttl:CONGYISHEZHIGUOQISHIJIANDESHUJUJI(server. db[i]. expires)ZHONGTIAOXUANJIANGYAOGUOQIDESHUJUTAOTAI。

● volatile-random:CONGYISHEZHIGUOQISHIJIANDESHUJUJI(server. db[i]. expires)ZHONGRENYIXUANZESHUJUTAOTAI。

● allkeys-lru:CONGSHUJUJI(server. db[i]. dict)ZHONGTIAOXUANZUIJINZUISHAOSHIYONGDESHUJUTAOTAI。

● allkeys-random:CONGSHUJUJI(server. db[i]. dict)ZHONGRENYIXUANZESHUJUTAOTAI。

全民快乐8● no-enviction(QUZHU):JINZHIQUZHUSHUJU。

 

193. redis 常见的性能问题有哪些?该如何解决?

 

ZHUFUWUQIXIENEICUNKUAIZHAO,HUIZUSAIZHUXIANCHENGDEGONGZUO,DANGKUAIZHAOBIJIAODASHIDUIXINGNENGYINGXIANGSHIFEICHANGDADE,HUIJIANDUANXINGZANTINGFUWU,SUOYIZHUFUWUQIZUIHAOBUYAOXIENEICUNKUAIZHAO。


Redis ZHUCONGFUZHIDEXINGNENGWENTI,WEILEZHUCONGFUZHIDESUDUHELIANJIEDEWENDINGXING,ZHUCONGKUZUIHAOZAITONGYIGEJUYUWANGNEI。

课程预约

全民快乐8

全民快乐8

全民快乐8