Advertisement

第26期 Redis源码分析:slowLog的实现与优化及hyperloglog算法的改进

阅读量:

今日所学习的内容涉及两个log相关的文件,这两个文件所实现的功能远超我最初的理解范围。起初,我误以为它们仅仅是用于记录不同类型日志的工具,但随着学习的深入,我才逐渐意识到其中的差异。原来slowLog用于记录超时查询的相关信息,而hyperloglog则与日志毫无关联。说实话,这让我再次感到惊讶,因为hyperloglog实际上是一种用于基数统计的算法,应当将其拆解为hyper与loglog两部分来理解。接下来,我们将详细探讨Redis代码中是如何具体实现这些功能的。

slowLog的官方解释:

复制代码
 /* Slowlog implements a system that is able to remember the latest N

    
  * queries that took more than M microseconds to execute.
    
  * * The execution time to reach to be logged in the slow log is set
    
  * using the 'slowlog-log-slower-than' config directive, that is also
    
  * readable and writable using the CONFIG SET/GET c

全部评论 (0)

还没有任何评论哟~