西维蜀黍

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

iOS

对于 iOS 9.2 及更低版本,苹果唯一的自动化技术被称为UIAutomation,它运行在 Instruments 中。从 iOS 10 开始,苹果已经完全删除了 UIAutomation 工具。

同时,苹果推出了一款名为XCUITest 的新型自动化技术,从 iOS 9.3iOS 10 及以上版本,这将是苹果唯一支持的自动化框架。

  ...


【Protobuf】Protocol Buffers 2中使用map

Maps

If you want to create an associative map as part of your data definition, protocol buffers provides a handy shortcut syntax:

map<key_type, value_type> map_field = N;

…where the key_type can be any integral or string type (so, any scalar type except for floating point types and bytes). Note that enum is not a valid key_type. The value_type can be any type except another map.

So, for example, if you wanted to create a map of projects where each Project message is associated with a string key, you could define it like this:

map<string, Project> projects = 3;

The generated map API is currently available for all proto2 supported languages. You can find out more about the map API for your chosen language in the relevant API reference.

  ...


【Cache System】Redis Cluster

Redis Cluster

Redis Cluster 是Redis3.0之后,官方提供的Redis集群解决方案,由 Redis 官方团队来实现。

在3.0之前,为了解决容量高可用用方面的需求,基本上只能通过客户端分片 + Redis sentinel或者添加 proxy(twemproxy、codis)方案解决。

Redis Cluster最大的特性,就是对Redis集群提供了水平扩展的能力(horizential scalibility),即当整个 Redis 集群出现存储容量或者性能 bottleneck 时,使用 Redis Cluster 可以通过增加新的 master Redis node从而快速解决bottleneck。

除此之外,Redis Cluster提供了强大的高可用机制(即 failure failover)。即当集群中任何一个master Redis node无法正常工作时(比如因为底层依赖的硬件故障、网络问题),它对应的 slave Redis node就会自动代替它(当然,这里有一个前提,是我们设置了slave Redis node)。

与Codis 和 Twemproxy 不同的是:Redis Cluster并非使用Porxy模式来连接集群节点,而是使用无中心节点的模式来组建集群(即没有coordinator)。

Redis Cluster实现在多个节点之间进行数据共享,即使部分节点失效或者无法进行通讯时,Cluster仍然可以继续处理请求。若每个主节点都有一个从节点支持,在主节点下线或者无法与集群的大多数节点进行通讯的情况下, 从节点提升为主节点,并提供服务,保证Cluster正常运行。

  ...


【Cache System】Redis 集群方案

Redis 集群方案

Redis 的集群解决方案有社区的,也有官方的,社区的解决方案有 CodisTwemproxy

Codis

Codis 由我国的豌豆荚团队开源

Twemproxy

Twemproxy 由Twitter团队开源。

  ...


【Redis】Codis Pipeline

codis proxy 处理 “pipeline” 的逻辑:只是在从client 到proxy 有效率的提升(因为使用一次 pipeline意味着只有一次RTT)。而从 proxy 到 redis node的这个过程,依然是对 pipeline 中的每个命令串行地分别进行处理,即使这些命令对应的key位于不同的slot。

By right,可以实现成当这些命令对应的key位于不同的slot,以slot为单位异步地去执行,以如果有两个命令,他们对应的key位于不同的slot,则这两条命令会被并行的去执行,而当他们对应的key位于同一个slot,则自然而然地串行的去执行(因为Redis是单线程的)。

  ...