Git Product home page Git Product logo

Comments (7)

iliuyt avatar iliuyt commented on July 21, 2024 2

@kezhenxu94
感谢解答,我有将skyapm-nodejs里的grpc更改为@grpc/grpc-js版本,压测发现内存不再激增,但我放到服务器上后,运行一周后,内存依旧会增高到1G左右,在不添加skyapm-nodejs包后,我的内存基本维持在100M。

from skyapm-nodejs.

kezhenxu94 avatar kezhenxu94 commented on July 21, 2024

@iliuyt 我这边使用你的 demo 代码无法复现, 加大 qps 也无法复现

image

from skyapm-nodejs.

iliuyt avatar iliuyt commented on July 21, 2024

@kezhenxu94

以下是我的环境

es集群
version: "2.0"
services:
   elasticsearch-central:
      image: elasticsearch:6.5.0
      container_name: es1
      volumes:
         - ./node/es1/data:/usr/share/elasticsearch/data
         - ./node/es1/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      environment:
         - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
         - ES_CLUSTERNAME=elasticsearch
      command: elasticsearch
      ports:
         - "9200:9200"
         - "9300:9300"
      networks:
         default:
            ipv4_address: 172.21.0.100
   elasticsearch-data:
      image: elasticsearch:6.5.0
      container_name: es2
      volumes:
         - ./node/es2/data:/usr/share/elasticsearch/data
         - ./node/es2/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      environment:
         - bootstrap.memory_lock=true
         - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
         - ES_CLUSTERNAME=elasticsearch
      command: elasticsearch
      ports:
         - "9201:9200"
         - "9301:9300"
      links:
         - elasticsearch-central:elasticsearch
      networks:
         default:
            ipv4_address: 172.21.0.101
   elasticsearch-head:
      image: mobz/elasticsearch-head:5
      container_name: head
      volumes:
         - ./head/Gruntfile.js:/usr/src/app/Gruntfile.js
         - ./head/_site/app.js:/usr/src/app/_site/app.js
      ports:
         - "9100:9100"
      links:
         - elasticsearch-central:elasticsearch
      networks:
         default:
            ipv4_address: 172.21.0.102

networks:
   default:
      external:
         name: common

skywalking

version: '3.3'
services:
  oap:
    image: apache/skywalking-oap-server:7.0.0-es6
    container_name: oap
    restart: always
    ports:
      - 11800:11800
      - 12800:12800
    environment:
      - SW_STORAGE=elasticsearch #Es的存储
      - SW_STORAGE_ES_CLUSTER_NODES=172.21.0.100:9200
      - TZ=Asia/Shanghai
    networks:
      default:
        ipv4_address: 172.21.0.201
  ui:
    image: apache/skywalking-ui:7.0.0
    container_name: ui
    depends_on:
      - oap
    links:
      - oap
    restart: always
    ports:
      - 18080:8080 #默认8080端口,这里设置18080映射到宿主机,可修改
    environment:
      collector.ribbon.listOfServers: 172.21.0.201:12800
    networks:
      default:
        ipv4_address: 172.21.0.202

networks:
  default:
    external:
      name: common
其他信息

from skyapm-nodejs.

iliuyt avatar iliuyt commented on July 21, 2024

另外阅读源码中有一些诱惑,能否帮忙解答
源码中 lib/cache/index.js中
1、put方法里的判断是什么意思?
2、scheduleConsumeData方法中为什么调用了this._timeout.unref();?

具体看我下面代码的注释

TraceSegmentCachePool.prototype.put = function(traceSegment) {
    this._bucket.push(traceSegment);
    // this._bucketSize是一个bool类型,这里和-1对比永远都是true
    // 第二个判断也没理解什么意思,为什么要用长度和bool对比
    if (this._bucketSize !== -1 && this._bucket.length >= this._bucketSize) {
        this.consumeData();
    } else if (!this._timeout) {
        this.scheduleConsumeData();
    }
};
TraceSegmentCachePool.prototype.scheduleConsumeData = function() {
    let self = this;
    this._timeout = setTimeout(function() {
        self.consumeData();
    }, this._flushInterval);
    // 这里调用unref就取消了发送请求,为什么要调用unref呢
    this._timeout.unref();
};

from skyapm-nodejs.

kezhenxu94 avatar kezhenxu94 commented on July 21, 2024

@iliuyt 多谢提供环境详情, 我晚上试试看

  1. 那个判断是个 bug, 已经修复了

if (this._bucketSize !== -1 && this._bucket.length >= this._bucketSize) {

  1. 我的理解是 unref 并不会取消发送, 只是让这个 timer 不会阻止 Node 进程退出, 类似 Java 中设置线程为 Daemon

from skyapm-nodejs.

wu-sheng avatar wu-sheng commented on July 21, 2024

建议检查后端是否有足够的处理能力。同时,需要检查

  • grpc组件是不是在进行streaming处理时,等待的服务端处理的结束信号才再次发送(onComplete信号)
  • buffer是否具有过载抛弃机制。

这是java agent在面临上述场景时的典型保护设计。

from skyapm-nodejs.

iliuyt avatar iliuyt commented on July 21, 2024

我看到bug最近已修复,#111

from skyapm-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.