Skip to content

Commit 7c6a431

Browse files
committed
add some draft
1 parent 2e1a375 commit 7c6a431

File tree

11 files changed

+413
-0
lines changed

11 files changed

+413
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# partition or shared
2+
3+
## word concept
4+
5+
### data skew(数据偏斜)/hot_sport(热点)
6+
7+
数据分片不平衡,部分分片数据和负载过大.
8+
9+
高负载分片被称为热点
10+
11+
### consistent hashing(一致性hash)
12+
13+
14+
### gossip protocol(流言协议)
15+
16+
17+
## shared method
18+
19+
20+
1) key-range shared
21+
22+
容易存在热点
23+
24+
2) key-hash shared
25+
26+
range-query in key-hash-shared must send to all shareds
27+
28+
3) consistent-hash shared(hash and range)
29+
30+
## 二级索引
31+
32+
33+
## share route
34+
35+
1) Round-Robin Load Balancer: 服务器内部自动路由到正确位置,客户端透明
36+
37+
2) 路由层(mongos)
38+
39+
3) 完全在客户端实现(ruby redis client)
40+
41+
42+
## TODO
43+
44+
[a fast, mini-memory consistent hash algorithm](https://arxiv.org/pdf/1406.2294v1.pdf)
45+
46+
[consistent hash random tree](https://www.akamai.com/us/en/multimedia/documents/technical-publication/consistent-hashing-and-random-trees-distributed-caching-protocols-for-relieving-hot-spots-on-the-world-wide-web-technical-publication.pdf)
47+
48+
[service discovery in cloud](http://jasonwilder.com/blog/2014/02/04/service-discovery-in-the-cloud/)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# replica复制
2+
3+
## word concept
4+
5+
### eventual consistency
6+
7+
最终一致性
8+
9+
### read-your-write
10+
11+
写后读
12+
13+
用户写入主库,读取未同步的从库
14+
15+
16+
### monotonic read
17+
18+
单调读
19+
20+
多次读取使用不同的replica, 导致上次读到的内容在下次未同步完成
21+
22+
### 一致前缀读
23+
24+
多个读取来自不同的replica,导致处于后面的数据比前面的数据先出现
25+
一般分片环境
26+
27+
### 版本向量
28+
29+
## replica algorithm
30+
31+
1) single leader
32+
33+
2) multi leader
34+
35+
3) leaderless
36+
37+
38+
## synchronously vs asynchronously
39+
同步与异步
40+
41+
完全同步replica会导致节点写入延迟高,容易失败.
42+
43+
完全异步写入有可能导致数据丢失,会读取的旧数据等数据不一致问题
44+
45+
46+
## add new replica
47+
48+
基于某一时间快照和快照对应的binlog的偏移位置
49+
50+
51+
## replica log
52+
53+
1) 基于语句
54+
55+
非确定函数等会导致数据不一致
56+
57+
2) 基于行(逻辑日志)
58+
59+
mysql新版使用这种方式
60+
61+
62+
## 多主复制
63+
64+
### 冲突解决
65+
66+
### 拓扑结构
67+
68+
69+
## ??
70+
w + r > n
71+
72+
73+
## TODO
74+
75+
[eventually consistent](https://queue.acm.org/detail.cfm?id=1466448)
76+
77+
[mysql-internals-manual](https://dev.mysql.com/doc/internals/en/)
78+
[mysql-inline](https://www.percona.com/live/mysql-conference-2013)
79+
80+
[clock are bad, welcome to distrubuted system](http://basho.com/posts/technical/clocks-are-bad-or-welcome-to-distributed-systems/)
81+
82+
[eventually consistent detecting](http://messagepassing.blogspot.com/2011/10/eventual-consistency-detecting.html)
83+
84+
[if you must deploy multi-master replication](http://scale-out-blog.blogspot.com/2012/04/if-you-must-deploy-multi-master.html)
85+
86+
[kafka replica](https://www.slideshare.net/junrao/kafka-replication-apachecon2013)

content/distributed_system/note.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# plan
2+
3+
看完design data-intension application和mit 8.624
4+
5+
6+
## design data-intension application
7+
8+
[gitbook](https://vonng.gitbooks.io/ddia-cn/content/ch7.html)
9+
10+
## mit 8.624
11+
12+
[mit schedule](https://pdos.csail.mit.edu/6.824/schedule.html)
13+
14+
[mit lecture translation](https://github.com/feixiao/Distributed-Systems)
15+
16+
[mit lecture note](https://github.com/chaozh/MIT-6.824)
17+
18+
[code example](https://github.com/xingdl2007/6.824-2017)
19+
20+
[mit 8.624 note](http://ts25504.github.io/2016/08/16/MIT-6-824%E5%AD%A6%E4%B9%A0%E4%B9%8B%E8%B7%AF/)
21+
22+
[zhihu.com](https://www.zhihu.com/question/29597104)
23+
24+
25+
26+
[twitter](https://twitter.com/henryr/status/926148187156463616?lang=en)
27+
[good lecture](https://www.quora.com/Which-is-a-good-online-course-for-studying-distributed-systems-Video-lectures-preferred)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
snippet meta "note meta header for tags,title,summary,date" !b
2+
Author: hackrole
3+
4+
Date: `date +"%Y-%m-%d"`
5+
Tags: ${1}
6+
Title: ${2}
7+
Tummary: ${3}
8+
$0
9+
endsnippet

content/django/admin_note.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# django admin note
3+
4+
## doc read
5+
6+
### register admin
7+
8+
requirements: auth/message/session/content_type context_processors
9+
10+
```python
11+
#
12+
13+
#
14+
15+
#
16+
17+
```

content/go-micro/golang_note.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# golang tips
2+
3+
4+
## how to write golang
5+
6+
[offical how-to-write-go-code](https://golang.org/doc/code.html)
7+
8+
### all code in workspace, which different from other language
9+
10+
11+
### import_path and package_name
12+
13+
1) import_path need to be unique
14+
15+
2) import_path is not package_name
16+
17+
3) for convenience, `import_path == vcs_base_url<github.com/user>/ + package_name``, but this is not neccesary
18+
19+
4) execute_program package name must be main
20+
21+
5) all file in same import path must have same package_name
22+
23+
24+
## effective go
25+
26+
[effective go](https://golang.org/doc/effective_go.html#names)
27+
28+
### go examples
29+
30+
### format
31+
gofmt auto do this.
32+
33+
use indentation instead of space
34+
35+
line length is at you wish.
36+
37+
### comment and doc
38+
39+
package_doc is before `package name`,
40+
in many file package should only one-file define it.
41+
it usually define in doc.go.
42+
43+
it should only be text, html is not good idea.
44+
45+
46+
func/variable doc is comment immediately preceding a top-level declaration.
47+
Every exported (capitalized) name in a program should have a doc comment.
48+
49+
### names
50+
51+
1) package name should be good: short, concise, evocative
52+
53+
2) packages are given lower case, single-word names; there should be no need for underscores or mixedCaps.
54+
55+
3) Getter -> <Owner>(Captial). setter -> (SetOwner)(with Set prefix)
56+
57+
4) one-method interfaces are named by the method name plus an -er(Ex: Reader, Writer, Formatter)
58+
59+
5) Read/Write/String and so on not use in your func name.
60+
61+
6) use MixCaps instead of underscore for multiword-names.
62+
63+
7) Semicolons is not required.
64+
65+
# control stucture
66+
67+
1) if/for support short declare
68+
69+
2) for is for/while/foreach
70+
71+
3) foreach => for i, v := range items
72+
73+
4) switch and fallthrough
74+
75+
5) type_switch
76+
```golang
77+
switch t := t.(type) {
78+
case bool: ...
79+
case int: ...
80+
}
81+
```
82+
83+
84+
## the go programming spec
85+
86+
[offical go spec](https://golang.org/ref/spec)

content/go-micro/microservice.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# micro-service concept
2+
3+
4+
[martin fowler blog](https://martinfowler.com/articles/microservices.html)
5+
6+
# operations model for microservice
7+
8+
[tekink operations model for microservice](http://callistaenterprise.se/blogg/teknik/2015/03/25/an-operations-model-for-microservices/)
9+
10+
11+
# circuitBreaker 断路器
12+
13+
[martin circuit breaker](https://martinfowler.com/bliki/CircuitBreaker.html)
14+
15+
[netflix hystrix circuit-breaker](https://github.com/Netflix/Hystrix/)

content/plan.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# microservice
2+
## go-micro framework
3+
## martni flow blog
4+
## grpc
5+
## hashiple tools
6+
7+
# distribution system
8+
9+
## desgin data-intension application
10+
11+
## mit 6.824
12+
13+
# python
14+
15+
## alogrithm
16+
17+
[algorithm](https://github.com/keon/algorithms)
18+
[algorithm](https://github.com/grantjenks/python-sortedcontainers)
19+
20+
[python patterns](https://github.com/faif/python-patterns)
21+
[python patterns](https://github.com/tylerlaberge/PyPattyrn)
22+
23+
## source-code
24+
25+
requests
26+
27+
flask
28+
29+
hub
30+
31+
tornado
32+
33+
django
34+
35+
## numpy/matplatlib/keras/sklearn/dask
36+
37+
# Golang
38+
39+
## go book
40+
41+
## go stdlib
42+
43+
## go-micro
44+

content/plan.org

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* microservice
2+
** TODO go-micro framework
3+
** TODO martni flow blog
4+
** TODO grpc
5+
** TODO hashiple tools
6+
7+
* TODO distribution system
8+
9+
** TODO desgin data-intension application
10+
11+
** TODO mit 6.824

content/python/editor_tools.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# editor tools
2+
3+
## isort
4+
5+
## yapf
6+
7+
## emacs lpy
8+
9+
## emacs ob-python

0 commit comments

Comments
 (0)