西维蜀黍

🐒 Software engineer | 📷Photographer | 👹Urban explorer

  • 主页
  • 所有文章
Tag Friends

西维蜀黍

🐒 Software engineer | 📷Photographer | 👹Urban explorer

  • 主页
  • 所有文章

【并发控制】乐观并发控制(Optimistic Concurrency Control)与悲观并发控制(Pessimistic Concurrency Control)

2019-02-17

Update

2020.6.1 update:今天和室友讨论,发现大家都看的是 “乐观锁、悲观锁,这一篇就够了!” (https://segmentfault.com/a/1190000016611415)来学习乐观并发控制和悲观并发控制。

然而,这篇文章中提到了 “乐观锁” 的概念,而这个词本身就是自相矛盾的,i.e., 锁(lock),或者称为互斥锁(mutex)本身就是基于悲观并发控制思想,所以根本不存在 “乐观锁” 这种锁。取而代之,将其称为 “乐观并发控制思想” 则相对更合适。

其实,搜索一下”optimistic locking”,发现仍然还是有很多的结果,这说明这其实不是因为翻译的原因。

今天突然意识到了这个问题,于是重新更新了这篇 blog。

Background

并发控制(Concurrency Control)

需要并发控制(Concurrency Control),其实是为了实现某些一致性规则(consistency rules)。

需要并发控制的一些场景:

  • 实现数据库的 ACID 中的一致性(consistency)
  • 编程中的实现互斥(mutual exclusion),比如 Java 中的 synchrinzed 方法

对应地,如果需要并发控制机制,但又没有应用任何并发控制机制,自然会产生某些问题,典型的包括:

  • Read-copy-update
  • The lost update problem: A second transaction writes a second value of a data-item (datum) on top of a first value written by a first concurrent transaction, and the first value is lost to other transactions running concurrently which need, by their precedence, to read the first value. The transactions that have read the wrong value end with incorrect results.
  • The dirty read problem: Transactions read a value written by a transaction that has been later aborted. This value disappears from the database upon abort, and should not have been read by any transaction (“dirty read”). The reading transactions end with incorrect results.
  • The incorrect summary problem: While one transaction takes a summary over the values of all the instances of a repeated data-item, a second transaction updates some instances of that data-item. The resulting summary does not reflect a correct result for any (usually needed for correctness) precedence order between the two transactions (if one is executed before the other), but rather some random result, depending on the timing of the updates, and whether certain update results have been included in the summary or not.

悲观并发控制(Pessimistic Concurrency Control)与乐观并发控制(Optimistic Concurrency Control)

乐观并发控制(Optimistic Concurrency Control)对应于生活中乐观的人总是想着事情往好的方向发展,悲观并发控制(Pessimistic Concurrency Control)对应于生活中悲观的人总是想着事情往坏的方向发展。这两种人各有优缺点,不能不以场景而定说一种人好于另外一种人。

悲观并发控制(Pessimistic Concurrency Control)

悲观并发控制(Pessimistic Concurrency Control)总是假设最坏的情况,即每次去拿数据的时候都认为别人会修改,所以每次在修改数据的时候都会先把数据 “锁起来”,来阻止其他人对数据的修改。

因此,自然地,实现悲观并发控制的最典型的方式就是使用锁(lock)了,

  • 传统的关系型数据库里边就用到了很多这种锁机制,比如行锁,表锁等,读锁,写锁等,即,都是在做操作之前先上锁。
  • Java 中基于 synchronized 关键字的独占锁(exclusive lock)就是基于悲观锁思想的实现。

当上锁后,即使别人想拿或者修改这个数据,也无法做到。因此,

  • 他可能会不断的重试(直到拿到这个锁),这称为自旋(spin);
  • 也可能直接进入阻塞状态(目的是为了节省 CPU 时间片)。直接当锁被释放时,会被唤醒且尝试再次获取锁。

悲观并发控制通常来说会造成性能的下降。而且,有时还会出现错误情况,比如死锁(deallock)

乐观并发控制(Optimistic Concurrency Control)

乐观并发控制(Optimistic Concurrency Control)则总是假设最好的情况,即认为每次去修改数据的时候,别人均不会修改,所以不会上锁,但是在更新的时候,会判断一下在此期间,别人有没有去更新这个数据。

代表

乐观并发控制思想的代表:

  • 多版本并发控制(Multiversion concurrency control, MVCC)
  • 非阻塞算法(non-blocking algorithm),非阻塞算法都依赖于 CPU 指令集提供的原子修改原语指令(atomic read-modify-write primitives),最典型的非阻塞算法就是 CAS 算法 (compare-and-swap)

场景:

  • 像数据库提供的类似于 write_condition 的机制,其实都是基于乐观锁并发控制思想的体现。
  • 在 Java 中 java.util.concurrent.atomic 包中,提供了很多支持原子操作的类。如:AtomicBoolean、AtomicInteger、AtomicLong、AtomicReference 等,全都是基于乐观并发控制思想的 CAS 算法实现的。
  • 在 SVN 、Git 等版本控制管理器中,也有乐观锁并发控制思想的体现。当你提交数据的时候对比下版本号,如果远程仓库的版本号和本地的不一样,就表示有人已经提交过代码了,你需要先更新代码到本地处理一下版本冲突问题,不然是没有办法提交的。
  • HTTP Header 中的 If-Match,The GET method returns an ETag for a resource and subsequent PUTs use the ETag value in the If-Match headers; while the first PUT will succeed, the second will not, as the value in If-Match is based on the first version of the resource

乐观锁适用于多读少写的应用类型,这样可以提高吞吐量。

乐观并发控制的几个阶段

Optimistic concurrency control transactions involve these phases:

  • Begin: Record a timestamp marking the transaction’s beginning.
  • Modify: Read database values, and tentatively write changes.
  • Validate: Check whether other transactions have modified data that this transaction has used (read or written). This includes transactions that completed after this transaction’s start time, and optionally, transactions that are still active at validation time.
  • Commit/Rollback: If there is no conflict, make all changes take effect. If there is a conflict, resolve it, typically by aborting the transaction, although other resolution schemes are possible. Care must be taken to avoid a TOCTTOU bug, particularly if this phase and the previous one are not performed as a single atomic operation.

乐观并发控制(Optimistic Concurrency Control)思想的分析

从上面对两种并发控制思想的介绍,我们知道两种锁各有优缺点,不可认为一种好于另一种。

乐观并发控制适用于写比较少的情况下(多读场景),即冲突很少发生,这样可以省去了加锁的开销,提高了系统的整个吞吐量。但如果是多写的情况,一般会经常产生冲突,这就会导致上层应用会不断的进行不断地多次尝试(retry),这样反倒是降低了性能,所以一般多写的场景下用悲观并发控制机制就比较合适。

乐观并发控制思想常见的两种实现方式

乐观锁可以使用多版本并发控制(Multiversion concurrency control, MVCC)或 CAS 算法来实现。

1 多版本并发控制(Multiversion concurrency control, MVCC)

这里的版本号可以任何属性,只要当一次数据修改操作被执行后,这个属性一定会被改变即可,比如数据被修改的次数、版本号、时间戳(timestamp)。

一般是在数据表中加上一个数据版本号 version 字段,表示数据被修改的次数,当数据被修改时,version 值会加一。当线程 A 要更新数据值时,在读取数据的同时,也会读取 version 值,在提交更新时,若刚才读取到的 version 值为当前数据库中的 version 值相等时才更新,否则重试更新操作,直到更新成功。

  • 取出记录时,获取当前 version;
  • 更新时,带上这个 version;
  • 执行更新,先执行 set version = newVersion where version = oldVersion;
  • 如果上面执行的 set 语句没有影响任何行,就更新失败;
  • 并且不断重试。

举一个简单的例子: 假设数据库中帐户信息表中有一个 version 字段,当前值为 1 ;而当前帐户余额字段( balance )为 $100 。

  1. 操作员 A 此时将其读出( version=1 ),并从其帐户余额中扣除 50(100-$50 )。
  2. 在操作员 A 操作的过程中,操作员 B 也读入此用户信息( version=1 ),并从其帐户余额中扣除 20(100-$20 )。
  3. 操作员 A 完成了修改工作,将数据版本号加一( version=2 ),连同帐户扣除后余额( balance=$50 ),提交至数据库更新,此时由于提交数据版本大于数据库记录当前版本,数据被更新,数据库记录 version 更新为 2 。
  4. 操作员 B 完成了操作,也将版本号加一( version=2 )试图向数据库提交数据( balance=$80 ),但此时比对数据库记录版本时发现,操作员 B 提交的数据版本号为 2 ,数据库记录当前版本也为 2 ,不满足 “ 提交版本必须大于记录当前版本才能执行更新 “ 的乐观锁策略,因此,操作员 B 的提交被驳回。

这样,就避免了操作员 B 用基于 version=1 的旧数据修改的结果覆盖操作员 A 的操作结果的可能。

2 非阻塞算法(non-blocking algorithm)

// TODO

  • Wait-freedom
  • Lock-freedom
  • Obstruction-freedom

非阻塞算法的好处

There are several benefits of non-blocking algorithms compared to blocking algorithms. This section will describe these benefits.

Choice

The first benefit of non-blocking algorithms is, that threads are given a choice about what to do when their requested action cannot be performed. Instead of just being blocked, the request thread has a choice about what to do. Sometimes there is nothing a thread can do. In that case it can choose to block or wait itself, thus freeing up the CPU for other tasks. But at least the requesting thread is given a choice.

On a single CPU system perhaps it makes sense to suspend a thread that cannot perform a desired action, and let other threads which can perform their work run on the CPU. But even on a single CPU system blocking algorithms may lead to problems like deadlock, starvation and other concurrency problems.

No Deadlocks

The second benefit of non-blocking algorithms is, that the suspension of one thread cannot lead to the suspension of other threads. This means that deadlock cannot occur. Two threads cannot be blocked waiting for each other to release a lock they want. Since threads are not blocked when they cannot perform their requested action, they cannot be blocked waiting for each other. Non-blocking algorithms may still result in live lock, where two threads keep attempting some action, but keep being told that it is not possible (because of the actions of the other thread).

No Thread Suspension

Suspending and reactivating a thread is costly. Yes, the costs of suspension and reactivation has gone down over time as operating systems and thread libraries become more efficient. However, there is still a high price to pay for thread suspension and reactivation.

Whenever a thread is blocked it is suspended, thus incurring the overhead of thread suspension and reactivation. Since threads are not suspended by non-blocking algorithms, this overhead does not occur. This means that the CPUs can potentially spend more time performing actual business logic instead of context switching.

On a multi CPU system blocking algorithms can have more significant impact on the overall performance. A thread running on CPU A can be blocked waiting for a thread running on CPU B. This lowers the level of parallelism the application is capable of achieving. Of course, CPU A could just schedule another thread to run, but suspending and activating threads (context switches) are expensive. The less threads need to be suspended the better.

Reduced Thread Latency

Latency in this context means the time between a requested action becomes possible and the thread actually performs it. Since threads are not suspended in non-blocking algorithms they do not have to pay the expensive, slow reactivation overhead. That means that when a requested action becomes possible threads can respond faster and thus reduce their response latency.

The non-blocking algorithms often obtain the lower latency by busy-waiting until the requested action becomes possible. Of course, in a system with high thread contention on the non-blocking data structure, CPUs may end up burning a lot of cycles during these busy waits. This is a thing to keep in mind. Non-blocking algorithms may not be the best if your data structure has high thread contention. However, there are often ways do redesign your application to have less thread contention.

CAS 算法

CAS 即 Compare And Swap(比较与交换),是一种无锁(Lock Free)的非阻塞算法(Non-blocking algorithm)的实现。 CAS 算法是基于乐观并发控制思想的实现体现。

无锁同步(Lock Free),即在不使用锁的情况下,实现多线程之间的变量同步,也就是在没有线程被阻塞的情况下实现变量的同步,所以也叫非阻塞同步(Non-blocking Synchronization)。

注意,无锁(lock-free)的非阻塞算法(nonblocking algorithms)有多种实现方法,CAS 算法只是其中的一种。

CAS 算法涉及到三个操作数:

  • 需要读写的内存值 V
  • 进行比较的值 A
  • 拟写入的新值 B

当且仅当 V 的值等于 A 时,CAS 通过原子方式用新值 B 来更新 V 的值,否则不会执行任何操作(比较和替换是一个原子操作)。一般情况下是一个自旋操作,即不断的重试。

CAS 算法通过 CPU 指令集保证原子性(atomicity),因此不需要进行用户态(user mode)和内核态(kernel mode)的切换,也不需要进行线程的切换。

这其实和乐观锁的冲突检查 + 数据更新的原理是一样的。

乐观并发控制的缺点

ABA 问题

比如说一个线程 T1 从内存位置 V 中取出 A ,这时候另一个线程 T2 也从内存中取出 A ,并且 T2 进行了一些操作变成了 B ,然后 T2 又将 V 位置的数据变成 A,这时候线程 T1 进行 CAS 操作发现内存中仍然是 A ,然后 T1 操作成功。尽管线程 T1 的 CAS 操作成功,但可能存在潜在的问题。

一个通常的解决 ABA 问题的思路是增加时间戳,即在进行数据更新时,不仅仅对比当前值与开始操作之前的值是不是一致,还对比最后修改数据的时间戳是否一致。

循环时间长开销大

自旋 CAS(不成功,就一直循环执行,直到成功)如果长时间不成功,会给 CPU 带来非常大的执行开销。

如果 JVM 能支持处理器提供的 pause 指令那么效率会有一定的提升,pause 指令有两个作用:

  • 它可以延迟流水线执行指令(de-pipeline),使 CPU 不会消耗过多的执行资源,延迟的时间取决于具体实现的版本,在一些处理器上延迟时间是零。
  • 它可以避免在退出循环的时候因内存顺序冲突(memory order violation)而引起 CPU 流水线被清空(CPU pipeline flush),从而提高 CPU 的执行效率。

只能保证一个共享变量的原子操作

当对一个共享变量执行操作时,我们可以使用循环 CAS 的方式来保证原子操作,但是对多个共享变量操作时,循环 CAS 就无法保证操作的原子性。

这个时候就可以用锁,或者有一个取巧的办法,就是把多个共享变量合并成一个共享变量来操作。比如有两个共享变量 i = 2,j = a ,合并一下 ij = 2a ,然后用 CAS 来操作 ij。从 Java 1.5 开始 JDK 提供了 AtomicReference 类来保证引用对象之间的原子性,你可以把多个变量放在一个对象里来进行 CAS 操作。

乐观并发控制的 CAS 与悲观并发控制的 Java synchronized 关键字的使用情景

结论先行:CAS 适用于写比较少的情况下(多读场景,冲突一般较少),Java 的 synchronized 关键字适用于写比较多的情况下(多写场景,冲突一般较多)。

  • 对于资源竞争较少(线程冲突较轻)的情况,使用 synchronized 同步锁进行线程阻塞和唤醒切换以及用户态内核态间的切换操作额外浪费消耗 CPU 资源;而 CAS 基于 CPU 指令集实现,不需要进入内核,不需要切换线程,操作自旋几率较少,因此可以获得更高的性能。
  • 对于资源竞争严重(线程冲突严重)的情况,CAS 自旋的概率会比较大,从而浪费更多的 CPU 资源,效率低于 synchronized。

补充: Java 并发编程这个领域中 synchronized 关键字一直都是元老级的角色,很久之前很多人都会称它为 “重量级锁” 。但是,在 JavaSE 1.6 之后进行了主要包括为了减少获得锁和释放锁带来的性能消耗而引入的 偏向锁 和 轻量级锁 以及其它各种优化之后变得在某些情况下并不是那么重了。

synchronized 的底层实现主要依靠 Lock-Free 的队列,基本思路是自旋后阻塞,竞争切换后继续竞争锁,稍微牺牲了公平性,但获得了高吞吐量。在线程冲突较少的情况下,可以获得和 CAS 类似的性能;而线程冲突严重的情况下,性能远高于 CAS 。

Reference

  • 《Modern Operating System 4th》
  • https://en.wikipedia.org/wiki/Concurrency_control#Concurrency_control_in_operating_systems
  • https://en.wikipedia.org/wiki/Non-blocking_algorithm
  • https://en.wikipedia.org/wiki/Compare-and-swap
  • https://www.cs.cmu.edu/~410-s05/lectures/L31_LockFree.pdf
  • https://en.wikipedia.org/wiki/Multiversion_concurrency_control
  • https://en.wikipedia.org/wiki/Optimistic_concurrency_control
  • http://tutorials.jenkov.com/java-concurrency/non-blocking-algorithms.html
  • https://preshing.com/20120612/an-introduction-to-lock-free-programming/
  • 面试必备之乐观锁与悲观锁 - https://juejin.im/post/5b4977ae5188251b146b2fc8
  • 乐观锁、悲观锁,这一篇就够了!- https://segmentfault.com/a/1190000016611415
  • Operating System
  • OperatingSystem

扫一扫,分享到微信

【Programming】并发编程(Concurrent Programming)
【Operating System】进程 - 进程与线程
© 2020 西维蜀黍
  • Tag
  • Friends

tag:

  • Algorithm Problem
  • AWS
  • Algorithm
  • Architectural Pattern
  • Architecture
  • ArchitectureDesign
  • Nginx
  • Frontend
  • Cache
  • Browser
  • C#
  • Debug
  • Visual Studio
  • Cache System
  • Compile
  • Data Structure
  • JavaScript
  • Data Format
  • Database
  • Design Pattern
  • Distributed System
  • Microservices
  • Django
  • Redis
  • Docker
  • ELK
  • Format
  • Git
  • Version Control
  • Golang
  • HTTP
  • Network
  • Hardware
  • Interview
  • JQuery
  • Java EE
  • Software Testing
  • Java
  • Network Programming
  • LaTeX
  • Linux
  • Operating System
  • Linxu
  • Lock
  • macOS
  • Markdown
  • Lucene
  • Mattermost
  • MySQL
  • Netwok
  • Netwrok
  • Node.js
  • nvm
  • NPM
  • npm
  • OOP
  • OpenWrt
  • Operating Systems
  • Performancede
  • Performance
  • Programming
  • Protobuf
  • Python
  • RaspbeeryPi
  • Codis
  • SQL
  • Regular Expression
  • Security
  • Spring
  • TypeScript
  • VMware
  • Vmware
  • Windows
  • WordPress
  • VPN
  • hexo
  • ZooKeeper
  • iOS
  • hugo

    缺失模块。
    1、在博客根目录(注意不是 yilia 根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    2、在根目录_config.yml 里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: true
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 【Microservices】Service Mesh(服务网格)

    2020-08-22

    #Microservices

  • 【Golang】性能分析 - 监控 Golang 程序的垃圾回收

    2020-08-22

    #Golang

  • 【Golang】性能分析 - PProf

    2020-08-15

    #Golang

  • 【Linux】命令 - date

    2020-08-09

    #Linux

  • 【Python】Python3 的时间

    2020-08-09

    #Python

  • 【Python】Log Framework - logging

    2020-08-09

    #Python

  • 【hugo】使用

    2020-08-09

    #hugo

  • 【Python】Django - Django Shell

    2020-08-09

    #Python

  • 【Python】安装 Python

    2020-08-06

    #Python

  • 【Python】升级 Python 版本

    2020-08-06

    #Python

  • 【Golang】关键字 - defer

    2020-08-02

    #Golang

  • 【Golang】初始化(Intialization)

    2020-08-02

    #Golang

  • 【Golang】类型 - string

    2020-08-02

    #Golang

  • 【Golang】文档

    2020-08-02

    #Golang

  • 【Golang】编译 - 交叉编译(Cross Compilation)

    2020-08-02

    #Golang

  • 【Golang】关键字 - const

    2020-08-02

    #Golang

  • 【Protobuf】Protocol Buffers 性能

    2020-07-31

    #Protobuf

  • 【Protobuf】Protocol Buffers Demo

    2020-07-31

    #Protobuf

  • 【Golang】位运算

    2020-07-31

    #Golang

  • 【Protobuf】Protocol Buffers Convention Guide

    2020-07-29

    #Protobuf

  • 【Protobuf】Protocol Buffers 深入

    2020-07-28

    #Protobuf

  • 【Linux】命令 - nohup 命令

    2020-07-28

    #Linux

  • 【Microservices】服务调用

    2020-07-26

    #Microservices

  • 【Microservices】常见服务注册 / 发现实现框架

    2020-07-26

    #Microservices

  • 【VPN】Terminal 运行 Cisco AnyConnect VPN

    2020-07-26

    #VPN

  • 【Microservices】微服务 - 服务注册(Service Registry)和服务发现(Service Discovery)

    2020-07-26

    #Microservices

  • 【ZooKeeper】学习

    2020-07-25

    #ZooKeeper

  • 【ZooKeeper】安装

    2020-07-25

    #ZooKeeper

  • 【Java】安装

    2020-07-25

    #Java

  • 【Redis】Codis 安装

    2020-07-25

    #Cache System#Redis#Codis

  • 【Golang】Golang 安装

    2020-07-23

    #Golang

  • 【Performance】Prometheus - Exporter - Redis Exporter

    2020-07-23

    #Performancede

  • 【Performance】Prometheus 深入

    2020-07-23

    #Performance

  • 【Linux】安装 oh-my-zsh

    2020-07-23

    #Linux

  • 【Performance】Promethues - Exporter

    2020-07-22

    #Performance

  • 【Performance】Prometheus - Node Exporter

    2020-07-22

    #Performance

  • 【Performance】Prometheus 初入

    2020-07-22

    #Performance

  • 【Performance】Grafana 学习

    2020-07-22

    #Performance

  • 【Software Testing】App 自动化测试框架 - Appium

    2020-07-15

    #Software Testing

  • 【Software Testing】App 自动化测试框架

    2020-07-15

    #Software Testing

  • 【Protobuf】Protocol Buffers 2 中使用 map

    2020-07-12

    #Protobuf

  • 【Cache System】Redis Cluster

    2020-07-10

    #Cache System#Redis

  • 【Cache System】Redis 集群方案

    2020-07-10

    #Cache System#Redis

  • 【Redis】Codis Pipeline

    2020-07-10

    #Cache System#Redis#Codis

  • 【Mattermost】webhook

    2020-07-09

    #Mattermost

  • 【ELK】ELK(Elasticsearch+Logstash+Kibana)学习

    2020-07-07

    #ELK

  • 【Lucene】Lucene 语法

    2020-07-06

    #Lucene

  • 【MySQL】将执行结果输出到文件

    2020-07-06

    #MySQL

  • 【Golang】通过私有库安装依赖

    2020-07-06

    #Golang

  • 【Golang】生成随机数

    2020-07-06

    #Golang

  • 【Git】忽略已经提交的文件

    2020-07-06

    #Git

  • 【Golang】gvm - Golang 版本管理

    2020-07-06

    #Golang

  • 【Golang】代码检查

    2020-07-06

    #Golang

  • 【Golang】幽灵变量(Shadowed Variables)

    2020-07-06

    #Golang

  • 【OpenWrt】OpenWrt 学习

    2020-07-03

    #OpenWrt

  • 【Network】路由(Route)

    2020-06-27

    #Network

  • 【macOS】移除默认输入法

    2020-06-27

    #macOS

  • 【Network】NAT

    2020-06-27

    #Network

  • 【Vmware】安装 VMware EXSI 6.7

    2020-06-27

    #Vmware

  • 【OpenWrt】查看 CPU 温度

    2020-06-21

    #OpenWrt

  • 【Network】tcpdump 抓包

    2020-06-20

    #Network

  • 【Linux】修改 MAC 地址

    2020-06-20

    #Linux

  • 【Linux】查看网络信息

    2020-06-20

    #Linux

  • 【Linux】查看网络接口(Network Interface)

    2020-06-20

    #Linux

  • 【OpenWrt】MacOS 下红米路由器 AC2100 刷 OpenWrt

    2020-06-20

    #OpenWrt

  • 【Golang】Golang 遍历 map 时 key 随机化问题

    2020-06-14

    #Golang

  • 【hexo】使用 node 14 运行 hexo 报错

    2020-06-13

    #hexo

  • 【Linux】Oh-my-zsh 启动慢

    2020-06-13

    #Linux

  • 【Linux】查看当前所有进程

    2020-06-13

    #Linux

  • 【Linux】shell 和 shell 脚本的执行

    2020-06-13

    #Linux

  • 【Linux】Shell 和 Bash

    2020-06-13

    #Linux

  • 【Linux】bash 和 zsh 的启动脚本(.zshrc,.bash_profile,~/.profile 等区别)

    2020-06-13

    #Linux

  • 【Golang】go-redis Redis 连接库学习

    2020-05-24

    #Golang

  • 【Redis】Wireshark 分析 Redis 通讯

    2020-05-24

    #Redis

  • 【Docker】Docker Compose

    2020-05-24

    #Docker

  • 【macOS】brew 使用

    2020-05-24

    #macOS

  • 【Docker】Docker 常用命令

    2020-05-23

    #Docker

  • 【Redis】Codis

    2020-05-12

    #Cache System#Redis#Codis

  • 【Redis】Redis pipeline

    2020-05-09

    #Redis

  • 【Redis】Redis 性能分析 Insight

    2020-05-09

    #Redis

  • 【Redis】Redis 性能测试(redis-benchmark)

    2020-05-09

    #Redis

  • 【Redis】Redis High-availability

    2020-05-07

    #Redis

  • 【Redis】Redis 持久化(Persistence)

    2020-05-07

    #Redis

  • 【Redis】Redis 事务(Transaction)

    2020-05-07

    #Redis

  • 【Redis】Redis Key 长度与性能

    2020-05-07

    #Redis

  • 【Linux】Crontab

    2020-05-05

    #Linux

  • 【WordPress】使用 Docker 创建 WordPress 实例

    2020-05-05

    #WordPress

  • 【AWS】AWS CLI - s3 使用

    2020-05-05

    #AWS

  • 【Compile】交叉编译(Cross compiler)

    2020-05-05

    #Compile

  • 【Linux】Ubuntu 安装 Docker

    2020-05-01

    #Linux

  • 【Linux】shell 变量

    2020-04-26

    #Linux

  • 【Linux】makefile

    2020-04-25

    #Linux

  • 【MySQL】Out of range value for column

    2020-04-25

    #MySQL

  • 【Architecture】连接池(Connection Pool)

    2020-04-21

    #Architecture

  • 【MySQL】Too many connections

    2020-04-21

    #MySQL

  • 【Redis】查看连接信息

    2020-04-21

    #Redis

  • 【Redis】设置密码

    2020-04-21

    #Redis

  • 【Linux】iostat - 查看 IO 实时监控

    2020-04-21

    #Linux

  • 【MySQL】学习

    2020-04-12

    #MySQL

  • 【Architecture】架构学习

    2020-04-11

    #Architecture

  • 【Distributed System】无服务器(Serverless)

    2020-04-11

    #Distributed System

  • 【Network】网络测速工具 - iperf3

    2020-04-11

    #Network

  • 【Golang】JSON 序列化与反序列化

    2020-03-30

    #Golang

  • 【MySQL】用户和权限管理

    2020-03-29

    #MySQL

  • 【MySQL】MySQL 安全性设置

    2020-03-29

    #MySQL

  • 【MySQL】查看 log

    2020-03-29

    #MySQL

  • 【MySQL】Establishing a Database Connection

    2020-03-29

    #MySQL

  • 【Golang】Set 实现

    2020-03-22

    #Golang

  • 【Golang】go-redis 连接 Redis

    2020-03-22

    #Golang

  • 【Netwok】通过反向代理实现内网穿透

    2020-03-22

    #Netwok

  • 【Golang】内置函数

    2020-03-15

    #Golang

  • 【Golang】数据类型

    2020-03-15

    #Golang

  • 【Golang】循环

    2020-03-15

    #Golang

  • 【Golang】异常处理

    2020-03-15

    #Golang

  • 【Golang】静态数组(Array)和切片(slices)

    2020-03-15

    #Golang

  • 【Golang】函数

    2020-03-15

    #Golang

  • 【Golang】模块管理与引用

    2020-03-15

    #Golang

  • 【Golang】变量

    2020-03-15

    #Golang

  • 【Golang】枚举(enumeration)

    2020-03-15

    #Golang

  • 【Golang】变量访问域

    2020-03-15

    #Golang

  • 【Golang】map

    2020-03-15

    #Golang

  • 【Golang】struct

    2020-03-15

    #Golang

  • 【Golang】interface 和 interface {} 类型

    2020-03-15

    #Golang

  • 【Golang】类型转换 - 类型断言(Type Assertion)和强制类型转换

    2020-03-15

    #Golang

  • 【Hardware】ID 卡和 IC 卡

    2020-02-09

    #Hardware

  • 【MySQL】数据类型

    2020-01-31

    #MySQL

  • 【MySQL】MySQL 中的各种数据类型转换

    2020-01-31

    #MySQL

  • 【MySQL】命名习惯

    2020-01-31

    #MySQL

  • 【Golang】Golang 命令

    2020-01-30

    #Golang

  • 【Golang】指针(Pointers)

    2020-01-30

    #Golang

  • 【Golang】类型转换 - 获取变量类型

    2020-01-30

    #Golang

  • 【Linux】CentOS 安装 Docker

    2020-01-30

    #Linux

  • 【Protobuf】Protocol Buffers 入门

    2020-01-29

    #Protobuf

  • 【Golang】上传文件

    2020-01-29

    #Golang

  • 【Raspbeery Pi】树莓派玩耍

    2020-01-29

    #RaspbeeryPi

  • 【Network】电信光猫内网穿透

    2020-01-29

    #Network

  • 【Golang】Golang 使用 UUID

    2020-01-12

    #Golang

  • 【Golang】Golang 的环境变量

    2020-01-12

    #Golang

  • 【Golang】Golang 依赖管理 - go module

    2020-01-12

    #Golang

  • 【Golang】Golang 使用 gRPC

    2020-01-12

    #Golang

  • 【Golang】Golang 连接 MySQL

    2020-01-12

    #Golang

  • 【Golang】修改代码后自动重新编译并启动

    2020-01-12

    #Golang

  • 【Golang】使用 gorm(ORM 框架)

    2020-01-12

    #Golang

  • 【Golang】Web Framework - Gin 使用

    2020-01-12

    #Golang

  • 【Golang】Print

    2020-01-12

    #Golang

  • 【Format】csv

    2020-01-12

    #Format

  • 【Software Testing】Postman 深入

    2019-12-09

    #Software Testing

  • 【Linux】资源使用问题排查

    2019-12-09

    #Linux

  • 【Python】显示对象的所有 Attribute

    2019-12-06

    #Python

  • 【Python】print

    2019-12-01

    #Python

  • 【Python】断言(assert)

    2019-12-01

    #Python

  • 【WordPress】修改站点域名

    2019-12-01

    #WordPress

  • 【Python】常见错误

    2019-11-28

    #Python

  • 【SQL】select for update

    2019-11-26

    #SQL

  • 【Python】Basics - 特殊变量(Special Variables)

    2019-11-26

    #Python

  • 【Python】魔术方法(Magic Methods)

    2019-11-24

    #Python

  • 【Python】import 问题排查

    2019-11-23

    #Python

  • 【Python】pytest - 运行错误

    2019-11-18

    #Python

  • 【Python】 单元测试框架 - pytest

    2019-11-18

    #Python

  • 【Django】Django ORM - 文档整理

    2019-11-17

    #Django

  • 【Django】Django ORM - 性能优化

    2019-11-17

    #Django

  • 【Django】Django ORM - 使 DB Schema 生效

    2019-11-17

    #Django

  • 【Django】使用 Template

    2019-11-17

    #Django

  • 【MySQL】日志记录

    2019-11-17

    #MySQL

  • 【Python】枚举

    2019-11-17

    #Python

  • 【Python】is 和 ==

    2019-11-16

    #Python

  • 【Django】Django 静态资源和 HTML 文件管理

    2019-11-13

    #Django

  • 【Architectural Pattern】前端框架中的 MVC、MVP 和 MVVM

    2019-11-10

    #Architectural Pattern

  • 【Distributed System】分布式 session(Distributed Seesion)

    2019-11-10

    #Distributed System

  • 【hexo】使用 AWS s3 作为 hexo 图库

    2019-11-10

    #hexo

  • 【JQuery】获取对象

    2019-11-10

    #JQuery

  • 【Python】闭包和匿名函数

    2019-11-10

    #Python

  • 【Python】装饰器(Wrapper)

    2019-11-10

    #Python

  • 【Django】Django 路由规则

    2019-11-10

    #Django

  • 【Django】Django 创建 Django 项目或应用

    2019-11-10

    #Django

  • 【Django】template - 插入 Python 代码

    2019-11-10

    #Django

  • 【Django】Django ORM - QuerySet 序列化

    2019-11-10

    #Django

  • 【Django】Django ORM - 查询数据

    2019-11-10

    #Django

  • 【Django】Django ORM - CRUD

    2019-11-10

    #Django

  • 【Django】Django ORM - Define Model

    2019-11-10

    #Django

  • 【macOS】清除 DNS 缓存

    2019-11-06

    #macOS

  • 【Django】错误汇总

    2019-11-05

    #Django

  • 【Python】前缀

    2019-11-04

    #Python

  • 【MySQL】MySQL 错误记录

    2019-11-04

    #MySQL

  • 【Python】Comprehensions

    2019-11-01

    #Python

  • 【Python】Python 一切皆对象

    2019-11-01

    #Python

  • 【Python】I/O - 输入

    2019-11-01

    #Python

  • 【Python】Basics - Built-in Function(内置函数)

    2019-11-01

    #Python

  • 【Python】String

    2019-11-01

    #Python

  • 【Python】Collection - dict

    2019-11-01

    #Python

  • 【Python】Collection - list

    2019-11-01

    #Python

  • 【Python】Python Style Guide

    2019-11-01

    #Python

  • 【JavaEE】Java Servlet 和 JSP(JavaServer Pages)

    2019-11-01

    #Java EE

  • 【Database】聚集索引(Clustered Index)与非聚集索引(Non-clustered Index)

    2019-10-31

    #Database

  • 【Django】通过 ORM 访问 MySQL,插入 Emoji 报错

    2019-10-31

    #Django

  • 【MySQL】MySQL 的存储引擎(Storage Engines)- MyISAM 与 InnoDB

    2019-10-31

    #MySQL

  • 【Django】Django 项目部署到 uWSGI + Nginx 作为生产环境

    2019-10-28

    #Nginx#Django

  • 【HTTP】Web Server(Web 服务器)、Web Application Server(Web 应用服务器)和 CGI(Common Gateway Interface)的故事

    2019-10-28

    #HTTP#Network

  • 【Python】WSGI(Web Server Gateway Interface)、uWSGI Server、uwsgi、WSGI Application 的故事

    2019-10-28

    #Python

  • 【Python】Error Handling

    2019-10-28

    #Python

  • 【Architecture】Design - Error Handling

    2019-10-28

    #Architecture#ArchitectureDesign

  • 【Architecture】Design - Database Schema Design

    2019-10-28

    #Architecture#ArchitectureDesign

  • 【Architecture】Design - API Design

    2019-10-28

    #Architecture#ArchitectureDesign

  • 【Django】Django 使用 Redis

    2019-10-28

    #Django#Redis

  • 【Redis】自动过期

    2019-10-28

    #Redis

  • 【Python】变量作用域

    2019-10-27

    #Python

  • 【Redis】Redis 操作

    2019-10-27

    #Redis

  • 【Redis】安装 Redis

    2019-10-27

    #Redis

  • 【Python】PyCharm 中的 import 问题

    2019-10-27

    #Python

  • 【Python】Basics - 函数返回值

    2019-10-27

    #Python

  • 【Python】Exception

    2019-10-20

    #Python

  • 【Django】Error - Django : Table doesn't exist

    2019-10-20

    #Django

  • 【Python】import

    2019-10-20

    #Python

  • 【Django】Django 读写 Cookie

    2019-10-20

    #Django

  • 【HTTP】Cookie

    2019-10-20

    #HTTP

  • 【Python】Collection - set

    2019-10-20

    #Python

  • 【Python】Basics - 函数参数

    2019-10-20

    #Python

  • 【Django】Django Form

    2019-10-20

    #Django

  • 【SQL】清空表数据后如何让自增 ID 从 1 开始

    2019-10-20

    #MySQL#SQL

  • 【MySQL】ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key

    2019-10-20

    #MySQL

  • 【Django】Django 中的时间获取与相关问题

    2019-10-19

    #Django

  • 【Django】Django Shell

    2019-10-19

    #Django

  • 【Software Testing】Postman 中的 Cookies 设置

    2019-10-19

    #Software Testing

  • 【Nginx】MacOS 下安装 Nginx

    2019-10-19

    #Nginx#macOS

  • 【Node.js】 使用 nvm 管理本地 Node.js 版本

    2019-10-19

    #Node.js#nvm

  • 【Django】处理 PUT 和 DELETE 方法

    2019-10-08

    #Django

  • 【Python】杂 - virtualenv 管理 Python 项目依赖

    2019-10-08

    #Python

  • 【Python】Django - 连接 MySQL

    2019-10-08

    #Django

  • 【Python】杂 - 通过 pyenv 快速切换当前系统 Python 版本

    2019-10-06

    #Python

  • 【Python】杂 - macOS 下设置 Python 默认版本

    2019-10-06

    #Python

  • 【Python】API - 时间表示

    2019-10-06

    #Python

  • 【MySQL】MySQL 8 + macOS 错误:Authentication plugin 'caching_sha2_password' cannot be loaded

    2019-10-06

    #MySQL

  • 【Python】I/O - 异步 I/O

    2019-09-24

    #Python

  • 【Python】线程 - ThreadLocal

    2019-09-24

    #Python

  • 【Python】Basics - 类

    2019-09-23

    #Python

  • 【Python】线程 - 锁

    2019-09-23

    #Python

  • 【Python】线程 - 多线程(Multithreading)

    2019-09-23

    #Python

  • 【Python】线程 - 多进程

    2019-09-23

    #Python

  • 【Linux】命令 - cut 命令

    2019-09-17

    #Linux

  • 【Linux】Shell/Bash - 多命令执行、管道(pipeline)和重定向(redirection)

    2019-09-17

    #Linux

  • 【Linux】命令 - grep 命令

    2019-09-16

    #Linux

  • 【HTTP】RESTful

    2019-08-26

    #HTTP

  • 【HTTP】HTTP 请求方法(Methods)

    2019-08-26

    #HTTP

  • 【SQL】约束(Constraints)

    2019-08-22

    #SQL

  • 【SQL】常用 SQL 语句

    2019-08-22

    #SQL

  • 【Network】IPv4 地址

    2019-08-21

    #Network

  • 【Algorithm】算法思想 - 二分法(Binary Search)

    2019-08-16

    #Algorithm

  • 【Markdown】Markdown 使用中 HTML

    2019-08-15

    #Markdown

  • 【Java】运算符 - 乘法除法问题

    2019-08-14

    #Java

  • 【Java】源码 - BitSet

    2019-08-14

    #Java

  • 【Algorithm】动态规划 - 背包问题

    2019-08-13

    #Algorithm

  • 【Linxu】磁盘管理

    2019-08-08

    #Linxu

  • 【Python】协程(Coroutine)

    2019-08-08

    #Python

  • 【Python】Python 的单线程

    2019-08-06

    #Python

  • 【Python】Python 几种常用的测试框架

    2019-08-06

    #Python

  • 【Architecture】高并发

    2019-08-06

    #Architecture

  • 【Architecture】中台概念

    2019-08-06

    #Architecture

  • 【Algorithm】算法思想 - 分治算法(Divide and Conquer)

    2019-08-05

    #Algorithm

  • 【Algorithm】算法思想 - 贪心算法(Greedy Algorithm)

    2019-08-05

    #Algorithm

  • 【Algorithm】排序算法 - 计数排序(Counting Sort)

    2019-08-05

    #Algorithm

  • 【Architecture】系统架构考虑

    2019-08-05

    #Architecture

  • 【Distributed System】微服务 - Kubernetes 初步

    2019-08-04

    #Microservices

  • 【Distributed System】SOA 与 MicroServices

    2019-08-04

    #Distributed System#Microservices

  • 【Docker】减小 Docker 镜像体积

    2019-08-04

    #Docker

  • 【Performance】 性能指标(Performance Indicator)

    2019-08-04

    #Performance

  • 【Java】集合类 - PriorityQueue 类(优先队列)

    2019-08-02

    #Java

  • 【Linux】命令 - sed 命令

    2019-08-02

    #Linux

  • 【Linux】命令 - lsof 命令

    2019-08-01

    #Linux

  • 【Distributed System】云计算(Cloud Computing)

    2019-08-01

    #Distributed System

  • 【Data Structure】树 - 平衡二叉搜索树 - 有了二叉查找树、AVL 树为啥还需要红黑树?

    2019-08-01

    #Data Structure

  • 【Distributed System】消息队列 - RabbitMQ

    2019-08-01

    #Distributed System

  • 【Microservices】微服务(Microservice Architecture)

    2019-07-31

    #Microservices

  • 【Spring】Spring 框架

    2019-07-31

    #Spring

  • 【Database】读写分离(Read/Write Splitting)

    2019-07-31

    #Database

  • 【Data Structure】优先队列(Priority Queue)

    2019-07-31

    #Data Structure

  • 【Algorithm】排序算法 - 桶排序(Bucket Sort)

    2019-07-30

    #Algorithm

  • 【Algorithm】TopK 问题

    2019-07-30

    #Algorithm

  • 【Java】I/O - 读取数据

    2019-07-30

    #Java

  • 【Algorithm】排序算法 - 堆排序(Heap Sort)

    2019-07-30

    #Algorithm

  • 【Data Structure】堆(Heap)/ 二叉堆(binary heap)

    2019-07-29

    #Data Structure

  • 【Algorithm】算法思想 - 动态规划(Dynamic Programming)

    2019-07-29

    #Algorithm

  • 【Algorithm】递归(Recursion)

    2019-07-29

    #Algorithm

  • 【Algorithm】BigNum 原理

    2019-07-29

    #Algorithm

  • 【Algorithm】算法的时间复杂度(Time complexity)

    2019-07-27

    #Algorithm

  • 【Distributed System】负载均衡(Load balancing)

    2019-07-26

    #Distributed System

  • 【Algorithm】排序算法 - 归并排序(Merge Sort)

    2019-07-25

    #Algorithm

  • 【Netwrok】输入一个 URL 会发生什么

    2019-07-24

    #Netwrok

  • 【LaTeX】支持中文

    2019-07-24

    #LaTeX

  • 【Operating System】进程 - Linux 启动进程的几种方式

    2019-07-18

    #Linux#Operating Systems

  • 【Java】集合类 - LinkedHashMap

    2019-07-16

    #Java

  • 【Operating System】LRU(Least Recently Used)算法

    2019-07-15

    #Algorithm#Operating System

  • 【Network】HTTP 常用响应码

    2019-07-15

    #HTTP#Network

  • 【Database】分库分表

    2019-07-12

    #Database

  • 【Distributed System】柔性事务(Flexible Transactions)

    2019-07-12

    #Distributed System

  • 【Distributed System】一致性哈希(Consistent Hashing)

    2019-07-12

    #Distributed System

  • 【Distributed System】分布式事务(Distributed Transaction)

    2019-07-12

    #Distributed System

  • 【Java】锁 - Lock 接口

    2019-07-12

    #Java

  • 【Java】Java 关键字 - synchronized 关键字中的锁状态

    2019-07-12

    #Java

  • 【Lock】独享锁(Exclusive Lock) VS 共享锁(Shared Lock)

    2019-07-12

    #Java#Lock

  • 【Distributed System】分布式锁(Distributed Lock)

    2019-07-11

    #Distributed System

  • 【Distributed System】分布式系统

    2019-07-11

    #Distributed System

  • 【Operating System】I/O - 零拷贝(Zero-copy)

    2019-07-11

    #Operating System

  • 【Java】JVM - Java 内存模型中的缓存一致性(Cache Coherency)问题

    2019-07-11

    #Java

  • 【Java】Netty 入门

    2019-07-10

    #Java#Network Programming

  • 【Regular Expression】正则表达式(Regular Expression)

    2019-07-10

    #Regular Expression

  • 【Java EE】Jetty 入门

    2019-07-10

    #Java EE

  • 【Operating System】死锁(deadlock)

    2019-07-10

    #Operating System

  • 【Distributed System】消息队列(Message Queue)

    2019-07-10

    #Distributed System

  • 【Distributed System】Dubbo 入门

    2019-07-10

    #Microservices

  • 【Java】值传递与引用传递

    2019-07-10

    #Java

  • 【Linux】统计某文件 / 文件夹个数

    2019-07-10

    #Linux

  • 【Database】数据库连接池

    2019-07-09

    #Database

  • 【Operating System】I/O - 磁盘 I/O 相关概念

    2019-07-09

    #Operating System

  • 【Cache System】缓存穿透(Cache Penetration)、缓存雪崩(Cache Avalanche)与缓存击穿(Cache Breakdown)

    2019-07-08

    #Cache System

  • 【Algorithm】海量数据处理 - 布隆过滤器(Bloom Filter)

    2019-07-05

    #Algorithm

  • 【Algorithm】海量数据处理 - 位图(Bitmap)

    2019-07-05

    #Algorithm

  • 【Algorithm】海量数据处理 - MapReduce

    2019-07-05

    #Algorithm

  • 【Algorithm】海量数据处理 - hash 映射再取模 + hashmap 统计 + 排序

    2019-07-05

    #Algorithm

  • 【Algorithm】海量数据处理

    2019-07-05

    #Algorithm

  • 【Algorithm Problem】海量数据处理 - 10 亿 int 型数,统计只出现一次的数

    2019-07-05

    #Algorithm Problem

  • 【Security】Web 安全

    2019-07-04

    #Security

  • 【OOP】什么是多态

    2019-07-03

    #OOP

  • 【Java】基本数据类型 - 基本数据类型的类型转换

    2019-06-28

    #Java

  • 【Java】基本数据类型 - Java 支持的 8 种基本数据类型

    2019-06-28

    #Java

  • 【Algorithm】计算斐波纳契数(Fibonacci Number)

    2019-06-27

    #Algorithm

  • 【Algorithm】排序算法 - 希尔排序(Shell Sort)

    2019-06-26

    #Algorithm

  • 【Algorithm】排序算法 - 插入排序(Insertion Sort)

    2019-06-25

    #Algorithm

  • 【Algorithm】排序(Sorting)算法

    2019-06-25

    #Algorithm

  • 【Algorithm】排序算法 - 冒泡排序(Bubble Sort)

    2019-06-25

    #Algorithm

  • 【Algorithm】排序算法 - 快速排序(Quick Sort)

    2019-06-25

    #Algorithm

  • 【Interview】应聘者提问

    2019-06-19

    #Interview

  • 【Network】Shadowsocks 总结

    2019-06-19

    #Network

  • 【Data Structure】图(Graph) - 图的物理存储

    2019-06-14

    #Data Structure

  • 【Data Structure】图(Graph) - 图的深度优先搜索(Depth First Search)

    2019-06-14

    #Data Structure

  • 【Data Structure】多叉搜索树 - Trie 树(字典树)

    2019-06-13

    #Data Structure

  • 【Database】数据库索引(Index)

    2019-06-10

    #Database

  • 【Database】数据库索引为什么使用 B+ 树

    2019-06-10

    #Database

  • 【Data Structure】多路平衡查找树 - B+ 树(B+ Tree)

    2019-06-05

    #Data Structure

  • 【Data Structure】多路平衡查找树 - B 树(B-Tree)

    2019-06-04

    #Data Structure

  • 【Data Structure】多路平衡查找树 - 2-3 查找树和 2-4 查找树

    2019-06-04

    #Data Structure

  • 【Algorithm】查找算法

    2019-06-03

    #Algorithm

  • 【Network】Charles 为什么可以获取 HTTPS 包内容

    2019-05-31

    #Network

  • 【Data Structure】哈希表(Hash table)

    2019-05-30

    #Data Structure

  • 【Data Structure】常用数据结构的时间复杂度

    2019-05-30

    #Data Structure

  • 【Data Structure】哈夫曼树(Huffman Tree)

    2019-05-30

    #Data Structure

  • 【Data Structure】平衡二叉搜索树 - 红黑树(Red-Black Tree)

    2019-05-30

    #Data Structure

  • 【Data Structure】平衡二叉搜索树 - AVL 树

    2019-05-30

    #Data Structure

  • 【Data Structure】自平衡二叉搜索树(Self-balancing Binary Search Tree)

    2019-05-29

    #Data Structure

  • 【Data Structure】二叉搜索树(Binary Search Tree)

    2019-05-29

    #Data Structure

  • 【Data Structure】线索二叉树(Threaded Binary Tree)

    2019-05-28

    #Data Structure

  • 【Data Structure】二叉树的遍历(Traversal)

    2019-05-27

    #Data Structure

  • 【Data Structure】二叉树(Binary Tree)

    2019-05-27

    #Data Structure

  • 【Network】OpenWrt 的路由器 ssh 访问

    2019-05-27

    #Network

  • 【Data Structure】广义表

    2019-05-24

    #Data Structure

  • 【Data Structure】矩阵

    2019-05-24

    #Data Structure

  • 【Data Structure】树(Tree)

    2019-05-24

    #Data Structure

  • 【Algorithm】字符串匹配算法 - 朴素的字符串匹配算法(Naive String Matching Algorithm)

    2019-05-23

    #Algorithm

  • 【Algorithm】字符串匹配算法 - KMP 算法

    2019-05-22

    #Algorithm

  • 【Data Structure】串(String)

    2019-05-21

    #Data Structure

  • 【Data Structure】队列(Queue)

    2019-05-21

    #Data Structure

  • 【Data Structure】栈的应用

    2019-05-17

    #Data Structure

  • 【Java】集合类 - Stack

    2019-05-16

    #Java

  • 【Data Structure】栈(Stack)

    2019-05-16

    #Data Structure

  • 【Java】运算符 - 位运算符

    2019-05-16

    #Java

  • 【Data Structure】循环链表(Circular Linked List)

    2019-05-16

    #Data Structure

  • 【Data Structure】双向链表 (Doubly Linked List)

    2019-05-16

    #Data Structure

  • 【Java】集合类 - LinkedList

    2019-05-16

    #Java

  • 【Data Structure】链表 (Linked List)

    2019-05-16

    #Data Structure

  • 【Java】集合类 - ArrayList

    2019-05-15

    #Java

  • 【Data Structure】顺序表

    2019-05-15

    #Data Structure

  • 【Algorithm】什么是算法(Algorithm)

    2019-05-15

    #Algorithm

  • 【Data Structure】什么是数据结构

    2019-05-14

    #Data Structure

  • 【Data Structure】线性表(Linear List)

    2019-05-14

    #Data Structure

  • 【Data Structure】图(Graph)

    2019-05-14

    #Data Structure

  • 【Algorithm Problem】统计文章中每个单词出现的次数

    2019-05-14

    #Algorithm Problem

  • 【Algorithm】排序算法 - 选择排序(Selection Sort)

    2019-05-14

    #Algorithm

  • 【Algorithm】查找算法(Search) - 二分搜索算法 (Binary Search)

    2019-05-13

    #Algorithm

  • 【Security】Wireshake 抓包分析 HTTPS

    2019-05-13

    #Security

  • 【Security】HTTPS

    2019-05-13

    #Security

  • 【Security】安全的 HTTP 的演化

    2019-05-13

    #Security

  • 【Security】密码学基础

    2019-05-13

    #Security

  • 【Network】HTTP 协议的演变

    2019-05-08

    #HTTP#Network

  • 【Network】IP 协议(网际协议)

    2019-05-08

    #Network

  • 【Network】UDP

    2019-05-08

    #Network

  • 【Network】TCP/IP

    2019-05-08

    #Network

  • 【Network】TCP 的拥塞控制(Congestion Handling)

    2019-05-08

    #Network

  • 【Network】TCP 的流量控制(Traffic Control) - 滑动窗口(Sliding Window)

    2019-05-07

    #Network

  • 【Network】TCP 为什么是三次握手,而不是两次或四次?

    2019-05-06

    #Network

  • 【Network】TCP 四次挥手(TCP Four-way Wavehand)

    2019-05-06

    #Network

  • 【Network】Wireshark 抓包学习 TCP 通讯

    2019-05-03

    #Network

  • 【Network】TCP(Transmission Control Protocol)

    2019-05-03

    #Network

  • 【Network】TCP 三次握手(TCP Three-way Handshake)

    2019-05-03

    #Network

  • 【Design Pattern】结构类模式 — 装饰器模式(Decorator Pattern)

    2019-04-09

    #Design Pattern

  • 【Spring】Spring 中的 IoC

    2019-04-08

    #Spring

  • 【Spring】面向切面编程(AOP) 与 Spring

    2019-04-08

    #Spring

  • 【Design Pattern】结构类模式 —- 代理模式(Proxy Pattern)

    2019-04-05

    #Design Pattern

  • 【Java】泛型(Generics)

    2019-04-02

    #Java

  • 【Java】Java 对象的生命周期

    2019-04-02

    #Java

  • 【Java】Java 关键字 - transient 关键字

    2019-04-02

    #Java

  • 【Java】反射(Reflection)

    2019-04-02

    #Java

  • 【Java】instanceof 关键字与 isInstance 方法

    2019-04-01

    #Java

  • 【Java】类的访问修饰符(Access Qualifier)

    2019-04-01

    #Java

  • 【Java】Java 中的引用与如何避免 OutOfMemory

    2019-04-01

    #Java

  • 【Java】内部类(Inner Class)

    2019-04-01

    #Java

  • 【Java】Java 关键字 - static 关键字

    2019-04-01

    #Java

  • 【Java】抽象类(Abstract Class)与接口(Interface)

    2019-04-01

    #Java

  • 【OOP】重写(Overriding)与重载(Overloading)

    2019-04-01

    #OOP

  • 【Java】类(Class)与继承(Inheritance)

    2019-03-29

    #Java

  • 【Java】访问修饰符(Access Modifier)

    2019-03-29

    #Java

  • 【Java】Java 动态代理(Dynamic Proxy)

    2019-03-28

    #Java

  • 【Java】对象的序列化(Serialization)与反序列化(Deserialization)

    2019-03-28

    #Java

  • 【Java】枚举 Enum

    2019-03-27

    #Java

  • 【Java】枚举实现单例模式

    2019-03-26

    #Java

  • 【Java】同步容器与线程安全问题

    2019-03-26

    #Java

  • 【Java】String - String.intern () 方法

    2019-03-26

    #Java

  • 【Java】垃圾回收 - 分代垃圾回收

    2019-03-26

    #Java

  • 【Java】对象的内存分配 - 垃圾回收过程

    2019-03-26

    #Java

  • 【Java】垃圾收集(Garbage Collection)

    2019-03-26

    #Java

  • 【Java】Java 关键字 - final 关键字

    2019-03-19

    #Java

  • 【Java】集合类 - 并发容器 (Concurrent Container)

    2019-03-18

    #Java

  • 【Java】集合类 - CopyOnWriteArrayList

    2019-03-18

    #Java

  • 【Java】hashCode()

    2019-03-18

    #Java

  • 【Java】集合类 - ConcurrentHashMap

    2019-03-18

    #Java

  • 【Java】集合类 - Map

    2019-03-18

    #Java

  • 【Java】集合类 - 遍历 Map 对象的几种方式

    2019-03-18

    #Java

  • 【Java】集合类 - 集合框架

    2019-03-15

    #Java

  • 【Java】集合类 - Set

    2019-03-15

    #Java

  • 【Java】集合类 - List

    2019-03-15

    #Java

  • 【Java】集合类 - Iterable 接口的 Fail-Fast 机制

    2019-03-15

    #Java

  • 【Java】集合类 - HashSet

    2019-03-15

    #Java

  • 【Java】集合类 - Queue

    2019-03-15

    #Java

  • 【Java】集合类 - TreeSet

    2019-03-15

    #Java

  • 【Java】集合类 - HashMap 的并发问题

    2019-03-14

    #Java

  • 【Java】集合类 - HashMap

    2019-03-14

    #Java

  • 【Java】集合类 - Collection 接口的三种遍历方法

    2019-03-14

    #Java

  • 【Java】集合类 - HashSet、HashMap 和 HashTable

    2019-03-13

    #Java

  • 【Java】== 与 equals ()

    2019-03-12

    #Java

  • 【Java】String - String,StringBuilder 和 StringBuffer

    2019-03-11

    #Java

  • 【Java】装箱(Boxing)与拆箱(Unboxing)

    2019-03-11

    #Java

  • 【Java】String - String 类和常量池

    2019-03-11

    #Java

  • 【Java】多线程 - Callable、Future 和 FutureTask

    2019-03-08

    #Java

  • 【Java】JVM - 双亲委派模型(Parents Delegation model)

    2019-03-07

    #Java

  • 【Java】JVM - 自定义类加载器

    2019-03-07

    #Java

  • 【Java】JVM - 对象访问

    2019-03-06

    #Java

  • 【Java】JVM - JVM 内存区域

    2019-03-06

    #Java

  • 【Java】JVM - 类加载机制(ClassLoad Mechanism)

    2019-03-06

    #Java

  • 【Java】JVM - 类加载器(Class Loader)

    2019-03-06

    #Java

  • 【Java】JVM 入门

    2019-03-06

    #Java

  • 【Java】JVM - HotSpot VM

    2019-03-05

    #Java

  • 【Java】JVM - Java 对象头(Header)

    2019-03-04

    #Java

  • 【Java】锁 - JVM 对内部锁的优化

    2019-03-04

    #Java

  • 【Java】I/O - I/O 模型与服务端编程

    2019-03-04

    #Java#Network Programming

  • 【Java】I/O - NIO 使用

    2019-03-04

    #Java

  • 【Java】字符(char)

    2019-03-03

    #Java

  • 【Java】 I/O - I/O 基本操作

    2019-03-03

    #Java

  • 【Java】 字符(串)编码与解码

    2019-03-02

    #Java

  • 【Java】多线程 - 线程间通信工具 CountDownLatch、CyclicBarrier 和 Phaser 类

    2019-03-01

    #Java

  • 【Lock】锁的几种特性

    2019-03-01

    #Java#Lock

  • 【Java】锁 - AQS

    2019-02-28

    #Java

  • 【Java】锁 - ReentrantLock 类

    2019-02-28

    #Java

  • 【Java】多线程 - Java 锁的演化

    2019-02-28

    #Java

  • 【Java】多线程 - Java 保证原子性、有序性、可见性

    2019-02-28

    #Java

  • 【Java】多线程 - 原子类(Atomic Classes)

    2019-02-27

    #Java

  • 【Java】锁 - CAS 无锁算法

    2019-02-27

    #Java

  • 【Java】多线程 - Happens-before 原则

    2019-02-27

    #Java

  • 【Java】多线程 - 线程安全(Thread Safety)

    2019-02-27

    #Java

  • 【Java】多线程 - ThreadLocal

    2019-02-27

    #Java

  • 【Java】多线程 - 守护线程(Daemon Thread)

    2019-02-26

    #Java

  • 【Network】两种高性能 I/O 设计模式(Reactor/Proactor)

    2019-02-26

    #Network#Network Programming

  • 【Java】多线程 - 线程状态切换函数

    2019-02-25

    #Java

  • 【Java】多线程 - 线程池(Thread Pool)

    2019-02-25

    #Java

  • 【Operating System】进程 - 协程(Coroutines)

    2019-02-25

    #Operating System

  • 【Java】JVM - Java 内存模型(Java Memory Model)

    2019-02-25

    #Java

  • 【Lock】锁的可重入性(Reentrancy)

    2019-02-25

    #Lock

  • 【Java】Java 关键字 - volatile 关键字

    2019-02-25

    #Java

  • 【Operating System】文件描述符(File Descriptor)

    2019-02-22

    #Operating System

  • 【Database】两阶段锁(Two-phase locking)

    2019-02-21

    #Database

  • 【Programming】并发编程(Concurrent Programming)

    2019-02-19

    #Programming

  • 【并发控制】乐观并发控制(Optimistic Concurrency Control)与悲观并发控制(Pessimistic Concurrency Control)

    2019-02-17

    #Operating System

  • 【Operating System】进程 - 进程与线程

    2019-02-14

    #Operating System

  • 【Operating System】系统调用

    2019-02-14

    #Operating System

  • 【Operating System】进程 - 进程 / 线程间通信

    2019-02-13

    #Operating System

  • 【Operating System】进程 - 进程 / 线程调度

    2019-02-10

    #Operating Systems

  • 【Linux】iptables 防火墙

    2019-02-02

    #Linux

  • 【Java】多线程 - 线程优先级

    2019-02-01

    #Java

  • 【Java】Java 关键字 - synchronized 关键字

    2019-01-31

    #Java

  • 【Java】多线程 - 线程基础

    2019-01-31

    #Java

  • 【Java】多线程 - Java 中的线程状态及状态切换

    2019-01-31

    #Java

  • 【Linux】SSH 登录与管理

    2019-01-31

    #Linux

  • 【Linux】命令 - scp 命令

    2019-01-30

    #Linux

  • 【Linux】命令 - dig 命令

    2019-01-30

    #Linux

  • 【Network】dnsmasq 初学

    2019-01-30

    #Network

  • 【Linux】定时任务

    2019-01-30

    #Linux

  • 【Network】Shadowsocks + OpenWRT + dnsmasq-full + ipset + gfwList 实现路由器(小米路由器 mini)自动翻墙

    2019-01-30

    #Network

  • 【OpenWrt】小米路由器 mini 刷 OpenWRT

    2019-01-30

    #OpenWrt

  • 【Network】C10K 问题与高性能网络编程入门

    2019-01-20

    #Network#Network Programming

  • 【Linux】Linux 中的 I/O 轮询技术

    2019-01-19

    #Linux#Operating System

  • 【Java】Java 关键字 - finally 关键字

    2019-01-18

    #Java

  • 【Architecture】Nginx 学习

    2019-01-18

    #Architecture#Nginx

  • 【Node.js】Node 的模块定义和使用

    2019-01-17

    #Node.js

  • 【Linux】硬链接与软链接

    2019-01-10

    #Linux

  • 【Distributed System】分布式系统的数据一致性(Data Consistency)

    2019-01-09

    #Distributed System

  • 【Distributed System】分布式事务 - 三阶段提交

    2019-01-09

    #Distributed System

  • 【Distributed System】分布式事务 - 两阶段提交

    2019-01-09

    #Distributed System

  • 【Distributed System】分布式理论 - BASE 理论

    2019-01-08

    #Distributed System

  • 【Distributed System】分布式理论 - CAP 理论

    2019-01-08

    #Distributed System

  • 【OOP】对象的深拷贝(Deep Copy)与浅拷贝(Shallow Copy)

    2019-01-07

    #OOP

  • 【Distributed System】远程过程调用(Remote Procedure Call,RPC)

    2019-01-07

    #Distributed System

  • 【Network】GFW 学习

    2019-01-06

    #Network

  • 【Redis】Redis 入门

    2019-01-06

    #Cache System#Redis

  • 【WordPress】WordPress 安全性设置

    2018-11-12

    #WordPress

  • 【Docker】Docker 的基本使用

    2018-11-12

    #Docker

  • 【Java】macOS 下编译 JDK8

    2018-11-12

    #Java

  • 【Node.js】Node.js 应用性能监测与分析

    2018-11-12

    #Node.js

  • 【Node.js】Node.js 中的单线程模型与多线程 / 进程

    2018-11-12

    #Node.js

  • 【Linux】Shell 脚本

    2018-11-12

    #Linux

  • 【Architectural Pattern】MVVM 与数据绑定

    2018-11-12

    #Architectural Pattern

  • 【Design Pattern】结构类模式 -- 模板方法模式 (Template Method Pattern)

    2018-11-12

    #Design Pattern

  • 【Design Pattern】结构类模式 -- 组合模式 (Composite Pattern)

    2018-11-12

    #Design Pattern

  • 【Design Pattern】结构类模式 -- 适配器模式 (Adapter Pattern)

    2018-11-12

    #Design Pattern

  • 【Design Pattern】结构类模式 -- 享元模式 (Flyweight Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】行为类模式 -- 观察者模式 (Obsever Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】行为类模式 -- 策略模式 (Strategy Pattern)

    2018-11-11

    #Design Pattern

  • 【Architectural Pattern】Model – View – Controller (MVC)

    2018-11-11

    #Architectural Pattern

  • 【Java】 Intellij 调试程序断点进入 JDK 源码

    2018-11-11

    #Java

  • 【Java】Java 程序的编译与运行

    2018-11-11

    #Java

  • 【JavaScript】JavaScript 单线程与异步

    2018-11-11

    #JavaScript

  • 【Python】Python 调试技巧

    2018-11-11

    #Python

  • 【iOS】 iOS 内存管理

    2018-11-11

    #iOS

  • 【Design Pattern】行为类模式 -- 备忘者模式(Memento Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】创建类模式 -- 单例模式 (Singleton Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】创建类模式 -- 建造者模式 (Builder Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】创建类模式 -- 工厂模式 (Factory Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】行为类模式 -- 状态模式 (State Pattern)

    2018-11-11

    #Design Pattern

  • 【Design Pattern】设计模式概念

    2018-11-11

    #Design Pattern

  • 【Markdown】Markdown 中的数学符号与公式

    2018-11-10

    #Markdown

  • 【Linux】命令 - time 命令

    2018-11-06

    #Linux

  • 【Operating System】I/O - 同步、异步与阻塞、非阻塞 I/O 问题

    2018-11-06

    #Operating System

  • 【Node.js】Node.js 的 Event Loop 与异步 I/O

    2018-11-06

    #Node.js

  • 【Linux】chmod/chown - Linux 文件 / 文件夹 权限

    2018-11-05

    #Linux

  • 【SQL】SQLite 命令

    2018-02-24

    #SQL

  • 【SQL】SQL 中几个关键字

    2018-02-24

    #SQL

  • 【WordPress】WordPress 安装插件时提示输入 FTP 账号信息

    2018-02-24

    #WordPress

  • 【WordPress】WordPress 修改管理员用户名名称

    2018-02-24

    #WordPress

  • 【OOP】依赖反转原则(The Dependency Inversion Principle)、控制反转(Inversion of Control)与依赖注入 (Dependency Injection)

    2018-02-24

    #OOP

  • 【MySQL】MySQL 常用命令

    2018-02-23

    #MySQL

  • 【MySQL】Mac 下安装 MySQL

    2018-02-23

    #MySQL

  • 【Java】JavaBean、POJO 和 EJB

    2018-02-23

    #Java

  • 【macOS】 macOS 下查看端口被哪个程序占用

    2018-02-23

    #macOS

  • 【Java】 集合类 - Java 中 List 的基本使用

    2018-02-23

    #Java

  • 【Security】用户验证及密码加密存储

    2018-02-23

    #Security

  • 【OOP】SOLID 原则

    2018-02-23

    #OOP

  • 【Operating System】换行符

    2018-02-23

    #Operating System

  • 【C#】 C# 委托

    2018-02-23

    #C#

  • 【C#】 C# 匿名函数

    2018-02-23

    #C#

  • 【Programming】函数式编程(Functional Programming)

    2018-02-23

    #Programming

  • 【Software Testing】软件测试的种类

    2018-02-23

    #Software Testing

  • 【iOS】通过 Xcode 任意指定 iPhone/iPad 的地理位置

    2017-09-27

    #iOS

  • 【Linux】Linux(CentOS 7)安全策略设置

    2017-09-27

    #Linux

  • 【Linux】命令 - curl 的使用

    2017-09-26

    #Linux

  • 【Linux】查看占用端口的进程

    2017-09-08

    #Linux

  • 【Nginx】Nginx 配置文件的语法检测与路径获取

    2017-09-08

    #Nginx

  • 【Java】javap(Java Class 文件分解工具)

    2017-06-08

    #Java

  • 【Windows】Windows 10 下在 Cmder 中使用 Linux Bash

    2017-06-08

    #Windows

  • 【Java】Java 反编译工具

    2017-06-04

    #Java

  • 【Network】Wireshark 常用过滤命令

    2017-06-04

    #Network

  • 【Network】单播(Unicast)、多播(Multicast)与广播(Broadcast)

    2017-06-04

    #Network

  • 【Network】DHCP 介绍与工作原理

    2017-06-04

    #Network

  • 【Java】Java 开发环境配置及踩的坑

    2017-06-04

    #Java

  • 【iOS】 iOS 不同操作系统兼容问题

    2017-05-15

    #iOS

  • 【Hardware】i386、x86 和 x64 的故事

    2017-04-30

    #Hardware

  • 【iOS】 Apple 移动设备处理器指令集与 Xcode 指令集相关设置

    2017-04-30

    #iOS

  • 【Linux】时间同步问题与 Linux NTP

    2017-04-25

    #Linux

  • 【Linux】CentOS7/RedHat7 NTP 服务无法开机自启动

    2017-04-25

    #Linux

  • 【Linux】查看 Linux 系统版本

    2017-04-24

    #Linux

  • 【VMware】 VMware 中安装 CentOS7

    2017-04-13

    #VMware

  • 【Linux】 Linux 包管理器

    2017-04-13

    #Linux

  • 【VMware】 VMware Workstation 与 Device/Credential Guard 不兼容

    2017-04-13

    #VMware

  • 【JavaScript】 JavaScript 单元测试框架:Jasmine

    2017-04-09

    #JavaScript#Software Testing

  • 【Operating System】环境变量(Environmental Variables)

    2017-04-09

    #Linux

  • 【Node.js】 Node.js 与 NPM 的模块版本管理

    2017-04-09

    #Node.js#npm

  • 【Network】DNS 原理分析

    2017-04-04

    #Network

  • 【C#】Visual Studio 2017 一边 Debug,一边修改代码

    2017-04-03

    #C##Debug#Visual Studio

  • 【Git】 Git 之忽略文件(gitignore)

    2017-04-03

    #Git#Version Control

  • 【Software Testing】 持续集成(Continuous integration)之粗浅理解

    2017-04-02

    #Software Testing

  • 【Data Format】JSON

    2017-04-01

    #JavaScript#Data Format

  • 【JavaScript】 JavaScript 定时器深入解析

    2017-03-31

    #JavaScript

  • 【HTTP】URL 总结

    2017-03-31

    #HTTP

  • 【VMware】 VMware12 中安装 macOS Sierra 10.12.3

    2017-03-13

    #macOS#VMware

  • 【SQL】 SQL 通配符使用

    2017-03-12

    #SQL

  • 【Node.js】 Node.js 与 NPM 入门

    2017-03-11

    #Node.js#NPM

  • 【Browser】 浏览器中的缓存机制

    2017-03-02

    #Frontend#Cache#Browser

  • 【TypeScript】 TypeScript 动态调试方法总结

    2017-03-02

    #Debug#TypeScript

  • My English Blog
  • My OJ Blog
  • 西维蜀黍的健身 Blog