4.最后一招:WatchDog

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云数据库 Tair(兼容Redis),内存型 2GB
简介:
官方说法提供的最后一招(last resort)就是WatchDog。它能够将慢操作的整个函数执行栈打印到Redis日志中。因为它与前面介绍过的将记录保存在内存中的延迟和满操作记录不同,所以记得使用前要在redis.conf中配置logfile日志路径:
  1. [root@vm redis-3.0.3]# src/redis-cli -h 127.0.0.1
  2. 127.0.0.1:6379> CONFIG SET watchdog-period 500
  3. OK
  4. 127.0.0.1:6379> debug sleep 1
  5. OK

  6. [root@vm redis-3.0.3]# tailf redis.log 
  7.       `-._    `-.__.-'    _.-'                                       
  8.           `-._        _.-'                                           
  9.               `-.__.-'                                               

  10. 51091:M 12 Aug 15:36:53.337 # Server started, Redis version 3.0.3
  11. 51091:M 12 Aug 15:36:53.338 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
  12. 51091:M 12 Aug 15:36:53.338 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
  13. 51091:M 12 Aug 15:36:53.343 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
  14. 51091:M 12 Aug 15:36:53.343 * DB loaded from disk: 0.000 seconds
  15. 51091:M 12 Aug 15:36:53.343 * The server is now ready to accept connections on port 6379

  16. 51091:signal-handler (1439365058) 
  17. --- WATCHDOG TIMER EXPIRED ---
  18. src/redis-server 127.0.0.1:6379(logStackTrace+0x43)[0x450363]
  19. /lib64/libpthread.so.0(__nanosleep+0x2d)[0x3c0740ef3d]
  20. /lib64/libpthread.so.0[0x3c0740f710]
  21. /lib64/libpthread.so.0[0x3c0740f710]
  22. /lib64/libpthread.so.0(__nanosleep+0x2d)[0x3c0740ef3d]
  23. src/redis-server 127.0.0.1:6379(debugCommand+0x58d)[0x45180d]
  24. src/redis-server 127.0.0.1:6379(call+0x72)[0x4201b2]
  25. src/redis-server 127.0.0.1:6379(processCommand+0x3e5)[0x4207d5]
  26. src/redis-server 127.0.0.1:6379(processInputBuffer+0x4f)[0x42c66f]
  27. src/redis-server 127.0.0.1:6379(readQueryFromClient+0xc2)[0x42c7b2]
  28. src/redis-server 127.0.0.1:6379(aeProcessEvents+0x13c)[0x41a52c]
  29. src/redis-server 127.0.0.1:6379(aeMain+0x2b)[0x41a7eb]
  30. src/redis-server 127.0.0.1:6379(main+0x2cd)[0x423c8d]
  31. /lib64/libc.so.6(__libc_start_main+0xfd)[0x3c0701ed5d]
  32. src/redis-server 127.0.0.1:6379[0x419b49]
  33. 51091:signal-handler (51091:signal-handler (1439365058) ) --------





本文作者:geelou
本文来自云栖社区合作伙伴rediscn,了解相关信息可以关注redis.cn网站。
相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
9月前
|
存储 算法 Linux
【Linux系统编程】进程状态
【Linux系统编程】进程状态
|
9月前
|
缓存 程序员 Linux
ARM中断来瞅瞅
ARM中断来瞅瞅
159 0
|
NoSQL Linux Shell
一探Linux下的七大进程状态-2
一探Linux下的七大进程状态
60 0
|
Linux Shell 调度
一探Linux下的七大进程状态-1
一探Linux下的七大进程状态
164 0
驱动开发:内核实现SSDT挂钩与摘钩
在前面的文章`《驱动开发:内核解析PE结构导出表》`中我们封装了两个函数`KernelMapFile()`函数可用来读取内核文件,`GetAddressFromFunction()`函数可用来在导出表中寻找指定函数的导出地址,本章将以此为基础实现对特定`SSDT`函数的`Hook`挂钩操作,与`《驱动开发:内核层InlineHook挂钩函数》`所使用的挂钩技术基本一致,不同点是前者使用了`CR3`的方式改写内存,而今天所讲的是通过`MDL映射`实现,此外前者挂钩中所取到的地址是通过`GetProcessAddress()`取到的动态地址,而今天所使用的方式是通过读取导出表寻找。
|
Linux
linux中断命令
linux中断命令
211 0