-
2023-12-29 JAVA volatile 关键字的一些问题记录 从一个例子出发 /** * Application */ public class Application { public volatile int count; public void add() { count++; } public static void main(String[] args) { Application application = new Application(); for (int i = 0; i < 100; i++) { new Thread(application::add).start(); }Created
Fri, 29 Dec 2023 13:23:55 +0000 -
runc 的一段代码 github源码 // CreateCgroupPath creates cgroupv2 path, enabling all the supported controllers. func CreateCgroupPath(path string, c *configs.Cgroup) (Err error) { if !strings.HasPrefix(path, UnifiedMountpoint) { return fmt.Errorf("invalid cgroup path %s", path) } content, err := supportedControllers() if err != nil { return err } const ( cgTypeFile = "cgroup.type" cgStCtlFile = "cgroup.subtree_control" ) ctrs := strings.Fields(content) res := "+"Created
Sat, 16 Dec 2023 22:31:15 +0000 -
2023-12-12 ES ILM Index Lifecycle Management 索引生命周期管理 (ILM) 是在 Elasticsearch 6.6(公测版)首次引入并在 6.7 版正式推出的一项功能。ILM 是 Elasticsearch 的一部分,主要用来管理索引 标记节点属性Created
Tue, 12 Dec 2023 10:08:02 +0000 -
一些技巧 查看进程参数 # pid ps -ef |grep python # 133 ls -l /proc/133 #### total 0 -r--r--r-- 1 root root 0 Dec 4 15:36 arch_status dr-xr-xr-x 2 root root 0 Dec 4 15:36 attr -rw-r--r-- 1 root root 0 Dec 4 15:36 autogroup -r-------- 1 root root 0 Dec 4 15:36 auxv -r--r--r-- 1 root root 0 Dec 4 15:07 cgroup --w-------Created
Mon, 04 Dec 2023 15:43:10 +0000 -
2023-09-29 ONLY_FULL_GROUP_BY ONLY_FULL_GROUP_BY 错误解决 现象 使用官方的docker镜像跑本地测试环境是应用报错. MYSQL 版本 JAVA异常 原因 设Created
Fri, 29 Sep 2023 12:51:27 +0000 -
Python 性能监控 line_profiler pip install line_profiler #!/usr/bin/env python # -*- coding: utf-8 -*- """ :Time : 2023/8/11 15:16 :Author : ren """ import sys import time from line_profiler import line_profiler profiler = line_profiler.LineProfiler() count = 1 @profiler def test(): global count for i in range(100): time.sleep(0.01) print(count) count += 1 print('finns')Created
Fri, 11 Aug 2023 15:27:42 +0000 -
GMP M: machine,对应系统核心线程 P: processor, 绑定m和G G: gonrutine go协程 go scheduler 发生调度的时机 go 新建goroutine GC GC会新建一个goroutine 系统调用 系统调用时 会堵塞M,所有该goroutine会被调度走 同步访问 atomic,mutex,chanal操作是goroutine堵塞. 工作窃取 当P2的本地队列没有G,优先从全局的G队列拿,如果还没有就会 CSP Do not communicate by sharing memory; instead, share memory by communicating. CSP 全称是 “Communicating Sequential Processes”,这也是 Tony Hoare 在 1978 年发表在 ACM 的一篇论文。论文里指出一门编程语言应该重视 input 和 output 的原语,尤其是并发编程的代码。 原则: 尽量使用 channel;把 goroutine 当作免费的资源,随便用。 link CSP GC 两类GC 追踪式GC 标记清楚: 标记整理: 解决内存碎片的问题 增量式: 将标记与清扫的过程分批执行,每次执行很小的部分,从而增量的推进垃圾回收,达到近似实时、几乎无停顿的目的 增量整理 分代 引用计数: 根据对象自己的引用计数俩回收,引用为0立即回收 不整理,并发的 三色标记清除算法Created
Mon, 10 Apr 2023 18:00:53 +0800 -
what is wsgi Web服务器网关接口 (Web Server Gateway Interface).Web服务器网关接口是为Python语言定义的Web服务器和Web应用程序或框架之间的一种简单而通用的接口 app.py def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any: """The actual WSGI application. This is not implemented in :meth:`__call__` so that middlewares can be applied without losing a reference to the app object. Instead of doing this:: app = MyMiddleware(app) It's a better idea to do this instead:: app.wsgi_app = MyMiddleware(app.wsgi_app) Then you still have the original application object around and can continue to call methods on it.Created
Mon, 10 Apr 2023 17:37:08 +0800