Giter Club home page Giter Club logo

Comments (4)

LinkinPF avatar LinkinPF commented on August 15, 2024

张玉哲:
系统可能下发多个指标,且每个指标的时间可能不一致,这就给管理带来了困难
我的想法是:把所有的指标抽象成一个类,每个单独的指标就是一个实例化
指标的执行就是一个该类的一个方法,每次下发指标到最后就交给一个对象来负责
方便处理了多指标时间不一致的问题

关于该指标类的思考,首先是成员,我觉得应该一个单独是的string,
代表要操作的python文件;执行指标的方法,可以写成一个使用一个go func()
来创建一个进程执行python,通过一个通道返回给主方法该进程的pid,主方法根据参数
设置定时器,定时器就是指标执行的时间,时间到,kill掉python进程

一个系统中一个指标只会有一个对象,这里使用单例模式来创建指标对象。

from lmp.

LinkinPF avatar LinkinPF commented on August 15, 2024

赵晨雨:
@张玉哲感觉是可行的,你是想避免全局类频繁创建吗,但是感觉你用这个大类一直在实例化新的对象,这个不是单例模式吧,单例模式不是只创建自己唯一的实例么,也可能是我理解有问题,最好画一个类图,看着会好一点,然后咱们再看。

from lmp.

LinkinPF avatar LinkinPF commented on August 15, 2024

张玉哲:
@赵晨雨(赵晨雨) 师兄,这里我把那个单例和享元搞混了,应该是享元模式。把每个指标的对象实例化之后,就保存下来。

from lmp.

LinkinPF avatar LinkinPF commented on August 15, 2024

赵晨雨:
@张玉哲 那这个就回到我们之前做项目的时候遇到的问题了,就是有没有必要上这个,享元模式是因为对象创建太多占内存导致性能下降了,但是我们的目前的场景下不会创建很多的类,这个是ebpf本身性能开销决定的。也就是ebpf的性能开销和go层创建对象的性能开销的对比。这个发到群里大家讨论下吧。

from lmp.

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.