Skip to content

Commit

Permalink
re
Browse files Browse the repository at this point in the history
  • Loading branch information
knightliao committed Jun 5, 2014
1 parent b8ecc70 commit f2893ed
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Distributed Configuration Management Tools

使用手册

配置说明
[配置说明](https://github.com/knightliao/disconf/wiki/%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E)

## 开发人员指南 ##

[详细设计文档](https://github.com/knightliao/disconf/wiki/design)
[详细设计文档](https://github.com/knightliao/disconf/wiki/Disconf%E8%AF%A6%E7%BB%86%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3)

[细节讨论](https://github.com/knightliao/disconf/wiki/detail-talk)
[细节讨论](https://github.com/knightliao/disconf/wiki/%E7%BB%86%E8%8A%82%E8%AE%A8%E8%AE%BA)

性能测试

Expand Down
64 changes: 44 additions & 20 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,47 @@
Disconf详细设计文档
=======



## 解决 配置“不一致性读“ 问题 ##

**问题描述:**

应用系统的配置更新过程,它会涉及到多个配置项的更新,它不是一个原子过程。如果在配置更新的过程中,应用程序去读取配置,这里可能存在些“时间窗口”,从而导致不一致性读问题。

**解决方法:**

Disconf支持Web或非Web系统,对于这个问题

- 解决方法一:提供ThreadContext包,每次请求都复制配置缓存,从而保证每次会话的数据的一致性。
- 解决方法二:提供ThreadContext包,每次请求都绑定一个版本号,如果读取时版本号不一致则报错,需要重新请求。
解决方法三:提供ThreadContext包,系统内保存有多个缓存层,读取时统一读取某个版本的缓存。每当配置更新时,缓存层增加。
解决方法四:方法二的加强版,添加注解,每次只复制强一制性的配置缓存。
第一种方法,代价太大。第二种方法,增加用户负担,第四种还是需要用户关心这个事情。第三种方法把压力给自己,所以采用。

对于非Web项目:
比较难解决非一致性读取的问题。因为它没有了会话这样一个概念。Apache的Reload配置文件也没有解决。我们打算放弃这方面的解决,或者只提供一个简单的解决方案:
让用户在读取配置的开始和结束时调用我们的函数进行标注表示本次读取为一次会话。
## 详细设计图: ##

![](http://ww4.sinaimg.cn/bmiddle/60c9620fgw1eh3d9pyghhj20r90qddj4.jpg)

[点击查看大图 ](http://ww4.sinaimg.cn/mw1024/60c9620fgw1eh3d9pyghhj20r90qddj4.jpg)

## 表结构设计 ##

配置数据是存储在Mysql里的。


config4project 配置(配置文件或配置项)
id 唯一的ID(没有啥意义,主键,自增长而已)
type 配置文件/配置项
name 配置文件名/配置项KeY名
value 配置文件:文件的内容,配置项:配置值
app appid
version 版本(类似: 1_0_0_0,可以为空,表示不需要版本)
env envid(可以为空,表示不需要环境)
create_time 生成时间
update_time 修改时间

config_group 配置组
id 唯一的ID(组ID,主键,自增长而已)
groupname 组名
desc 介绍

config_group_relation 配置组与配置关系表
id 唯一的ID(没有啥意义,主键,自增长而已)
group_id 组ID
config_id 配置ID

app
id APPID(主键,自增长)
name APP名(一般是产品线+服务名)
desc 介绍
create_time 生成时间
update_time 修改时间

env (rd/qa/local可以自定义)
id 环境ID(主键,自增长)
name 环境名字

0 comments on commit f2893ed

Please sign in to comment.