finley

Results 47 comments of finley

Netpoller has huge advantages in readability and acceptable performance, and it takes advantage of goroutine. So there are no plans to use the epoll model for the time being. But...

Redis style is not one of the goals. Godis even has a very un-redis style concurrency engine

Eviction 这边有几个问题: 1. runtime.ReadMemStats 需要 StopTheWorld, 成本极高 2. 对象可能已经不再使用但仍未 GC 3. 不确定需要逐出多少对象 我后来考虑了一下可以这样解决: 1. 首先使用 [gopsutil](https://pkg.go.dev/github.com/shirou/gopsutil/process#Process.MemoryInfo) 从操作系统中获取当前进程内存占用。它的成本很低不会影响正常运行。 2. 若 gopsutil 发现内存超限手动调用 runtime.GC 优先进行垃圾回收 3. 垃圾回收后使用 runtime.ReadMemStats 再次检查内存,若仍超限再进行逐出 4. 设置一个逐出的 batch...

RSS 是物理内存大小, VMS 是虚拟内存空间大小,这里当然使用 RSS. GC 后内存读数未减少的原因很复杂,比如 runtime.GC 不一定立即完成清理、回收的内存不一定立即还给操作系统。 runtime.GC() 后再次检查内存使用 runtime.ReadMemStat 而不用系统的 RSS 就是为了拿到尽可能实时的内存占用量。 我做了一些实验,总的来说由于 GC 和操作系统内存管理的各种机制存在很难拿到准确的内存使用量, eviction 只能尽力而为吧

> 如果这样的话,很容易下一次检查的时候发现内存超出限制 这事我之前还没考虑过,只能每次 eviction 之后一段时间内暂停 OOM 检测。 放到定时任务里是为了保证线上快速响应命令,每次执行命令都要查一下RSS会导致命令执行非常非常慢,定时任务不会影响命令执行速度。

That , Thread 1 locks in the order of A-B,and thread 2 locks in the order of B-A, will cause a deadlock.Therefore, the same order must be used for locking....

@NaNShaner 可以