Skip to content

Commit

Permalink
修改模块
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomeng79 committed Jun 23, 2021
1 parent fe836ba commit e73902c
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 2 deletions.
2 changes: 2 additions & 0 deletions 01语言/1go/10内存管理.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 内存管理

- [Go垃圾回收之三色标记算法](https://cloud.tencent.com/developer/article/1608932)

#### 常见的GC模式

- 引用计数(销毁引用,计数器-1,为0,回收)
Expand Down
15 changes: 15 additions & 0 deletions 03容器和集群/2k8s/service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Service

### type

[k8s四种port解析](https://blog.csdn.net/a772304419/article/details/113447005)

- nodePort:


### kube-proxy模式

- ip-tables模式:当service或者endpoints、pod发生变化时,kube-proxy会创建对应的iptables规则。
- Userspace模式:这种模式时最早的,不过已经不推荐使用了,效率低,因为需要在内核态和用户态多次转换。
- IPVS代理模式:当service有成千上万个的时候速度上会更占优势。而且有更多的lb策略。

15 changes: 15 additions & 0 deletions 04linux/1常用命令.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,19 @@ $ dig +trace +nodnssec www.baidu.com

```shell script
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
```

11. 查看打开文件句柄数排名

```shell script
lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr|more
```

12. 设置用户守护进程打开文件句柄数

```shell script
vim /etc/systemd/user.conf
vim /etc/systemd/system.conf
DefaultLimitNOFILE=100000
DefaultLimitNPROC=65535
```
4 changes: 3 additions & 1 deletion 12协议和概念/0目录.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@

8. [IPC](./8IPC.md)

9. [OSI模型](./9OSI模型.md)
9. [OSI模型](./9OSI模型.md)

10. [IaaS、PaaS、SaaS的区别](./10Iass-Pass-Sass.md)
3 changes: 3 additions & 0 deletions 12协议和概念/10Iass-Pass-Sass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## IaaS、PaaS、SaaS的区别

[IaaS、PaaS、SaaS的区别](https://zhuanlan.zhihu.com/p/276054509)
11 changes: 10 additions & 1 deletion 14数据结构和算法/1数据结构.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Tree:是n(n>=0)个节点的有限集T

二叉查找树要求,在树中的任意一个节点,左子树值<节点值<右子树值

#### 平衡树

平衡树(Balance Tree,BT) 指的是,任意节点的子树的高度差都小于等于1。

##### 特性

Expand Down Expand Up @@ -198,7 +201,13 @@ AVL树每次插入,删除,更新都要调整树,比较复杂,耗时,而红黑树
- 堆中每一个节点的值都必须大于等于(或小于等于)其子树中每个节点
- 大顶堆和小顶堆
- 插入一个数据的时候,我们把新插入的数据放到数组的最后,然后从从下往上堆化;删除堆顶数据的时候,我们把数组中的最后一个元素放到堆顶,然后从上往下堆化。这两个操作时间复杂度都是O(logn)


##### 最小四叉堆(高性能定时器)

[go定时器](https://zhuanlan.zhihu.com/p/149518569)

- 为什么使用四叉堆:1、上推节点快 2、对缓存友好(提高5%性能)

##### 为什么堆排序没有快速排序快

- 堆排序数据访问的方式没有快速排序友好,跳着访问,对cpu不友好
Expand Down
13 changes: 13 additions & 0 deletions 16架构/5缓存.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@
1. 缓存失效,加互斥锁,只有一个线程可以访问DB去请求数据缓存,其他线程sleep,然后再请求缓存
2. key不过期,维护一个假定过期时间,异步更新数据,性能好,代码复杂
3. 如果生成缓存数据十分耗时,需要主动更新缓存

#### 缓存一致性

- 原因: 数据更新的同时缓存数据没有实时更新
- 解决:
1. 主动更新

#### 缓存 “无底洞” 现象

- 原因: 为了满足业务要求添加了大量缓存节点,客户端一次批量操作会涉及多次网络操作,这意味着批量操作的耗时会随着节点数目的增加而不断增大
- 解决:
1. 优化批量数据操作命令
1. 减少网络通信次数

### 缓存淘汰算法
- FIFO(First In First Out)先进先出,时间维度**缺点**:最早添加但也最常被访问
- LFU(Least Frequently Used)最少使用,频率维度**缺点**:历史访问次数过高,而迟迟不能被淘汰
Expand Down

0 comments on commit e73902c

Please sign in to comment.