alibaba / alibaba/Sentinel

Reduce memory footprint of sentinel-dashboard Metric

Open
#1,530 0 comments 1 reaction 0 assignees View on GitHub
area/dashboard
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

英文不太好,用中文描述吧,请谅解

## Issue Description

Type: *feature request*

### Describe what happened (or what feature you want)
目前我们的sentinel-dashboard大概接入了200个应用,metric数据最开始是存储在内存(后面提出来了),应用分配的内存比较小,1G,发现Metric占用了大量的内存,实例数超过300W,资源名比较长,
在不增加内存的情况,一直fullGC 。
300W个实例,每个实例里面都存有app 和 resource 内容,资源吗比较长,占用太多内存

### Describe what you expected to happen
降低Metric占用的内存大小

### How to reproduce it (as minimally and precisely as possible)

1. 新增一种Metric存储策略,使用简化版的Metric实体
2.
3.

### Tell us your environment
sentinel1.4.0 (看过代码,存储这一块和目前最新的版本一样)

### Anything else we need to know?
我看了目前sentinel-dashboard metric展示相关代码,在最新版本(1.8.0-SNAPSHOT)中,大概只用到了MetricEntity实体中的4个属性:
时间:timestamp Date
通过 QPS:passQps Long
拒绝QPS:blockQps Long
响应时间:rt double

也就是说,就目前而言,MetricEntity中的其他属性是无用了,但是却占用了大量的内存(resource、app ),也许是为了扩展考虑吧?

所以,能否提供一个新的Metric存储策略,缩减无效属性,降低内存使用,如下:

public class LowMetricEntity {
private long timestamp;
private long gmtCreate;

private int successQps;
private int exceptionQps;
private int passQps;
private int blockQps;

/**
* summary rt of all success exit qps.
*/
private double rt;

/**
* 本次聚合的总条数
*/
private int count;
}

Contributor guide

Open the contributing guide

Research direction

Start by examining the dashboard metric storage path and the MetricEntity fields used by the metric display code. Define the reduced-memory storage strategy around the listed timestamp, QPS, response-time, and aggregation values, then verify that metric display behavior is preserved while memory usage decreases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.