Jager
Jager
Is the application running in the docker container? In the container, python recognizes the memory and CPUs of the host, not the resources limited of the container, which may cause...
@pguokun 我在腾讯云TKE(K8S)也发现有这个问题,内存增长趋于线性,内存缓缓增长到预设HPA之后会触发HPA弹性扩容,然后会一直扩再也不会缩回来了,得销毁重建才会回到最开始状态。 我们这边用的插件如下: 全局插件: - request-id - resonset-rewrite - kafka-logger 路由插件: - proxy-rewrite (5%) - consumer-restriction (70%) - hmac(70%) - limit-count (70%) 以下是2C2G的Pod配置,之前用的1C1G跑半个月就会触发HPA扩容了。   不太清楚这里面有没有GC机制,如果有GC,GC的触发条件是不是内存占用到一定程度时才触发?而运行在容器里面,程序看到的内存其实是宿主机的内存,而非容器limit内存,会导致永远不可能触发GC呢?目前Python3.7及以下版本就有这个问题,看到的是宿主机的资源,导致GC不会被主动执行。 以上,仅供参考哈~
> LuaJIT manages the GC total count in the GCState.total field, so it won't depend on the host's memory info. got it.
> 我们也发现了这个问题,之前以为是代码的问题,但是发现nginx进程实际占用的内存是非常小的,后面排查是因为写日志文件accesss.log/error.log过大,然后导致page cache会很大,因为k8s的内存统计是包括rss + buffer/cache的。 在执行执行echo "" > access.log之后发现内存是直线下降的。不知道这个问题是不是也是这个原因导致的。 > >  > > 解决办法:目前是通过log-rotate插件进行日志的滚动切割定期删除历史文件。 我们这边没有开文件日志,用的kafka-logger插件,也有泄漏问题。
@wjdhuster2018 请问你解决了吗? Have you resolved it ?
好的,回头我改进下。
> Hi @jagerzhang > The test nginx module is mainly used in the development process and is not suitable for container images. > We recommend using **cpanm** for installation, or...
额,几乎没用windows来开发项目,有没有试着在windows跑docker的方式开发?有空我试下windows怎么搞。
不太清楚你的部署架构,没法分析。。。