Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions for optimizing metric data query/writing in Sentinel dashboard #1174

Closed
yangyiweigege opened this issue Nov 21, 2019 · 5 comments
Labels
area/dashboard Issues or PRs about Sentinel Dashboard

Comments

@yangyiweigege
Copy link

目前 sentinel dashaboard应用数据写入内存/查询 使用的是简单粗暴的synchronize,所有的读/写请求 都是串行处理,当接入的应用较多,写入内存的数据量较大,存在性能问题。建议优化这部分代码,这里给出我的思路以及实现。
1.监控数据按照应用维度 进行锁分离;
2.同一应用 进行读写锁分离;
代码大致如下:
// app -> lock
private Map<String, ReadWriteLock> appLockMap = new ConcurrentHashMap(); //app 读写锁

readWriteLock.writeLock().lock();
监控数据写内存操作;
readWriteLock.writeLock().unlock(); //释放写锁

appLockMap.get(app).readLock().lock();
排序/查询数据操作
appLockMap.get(app).readLock().unlock();

@sczyh30 sczyh30 added the area/dashboard Issues or PRs about Sentinel Dashboard label Nov 21, 2019
@sczyh30 sczyh30 changed the title sentinel dashboard 监控数据写入/查询 优化建议 Suggestions for optimizing metric data query/writing in Sentinel dashboard Nov 21, 2019
@sczyh30
Copy link
Member

sczyh30 commented Nov 21, 2019

Good idea. Discussions and contributions are welcomed! You could also integrate with external storage (e.g. InfluxDB, Prometheus) based on the MetricsRepository interface.

@yangyiweigege
Copy link
Author

Good idea. Discussions and contributions are welcomed! You could also integrate with external storage (e.g. InfluxDB, Prometheus) based on the MetricsRepository interface.

我现在是这样做的。历史数据存储在HBase.每天1.5E 保留三十天。5分钟的实时数据还是存储内存查询(避免频繁查询Hbase 增加查询压力),所以对实时数据写入/查询 进行了这个优化。优化之前, 各种加锁操作 导致很多监控数据不能及时写入内存。下一次聚合数据就又来了。。。。最后恶性循环 慢慢的任务就被丢弃。。。最终实时监控数据 就消失掉了。。。。现在优化过后。已经不存在这个问题了。我们线上是200台机器 50个应用。

@linlinisme
Copy link
Collaborator

细化到服务接口维度会更好~

@linlinisme
Copy link
Collaborator

Refine to the service interface dimension can be better ~

@jasonjoo2010
Copy link
Collaborator

Close due to #1319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard Issues or PRs about Sentinel Dashboard
Projects
None yet
Development

No branches or pull requests

4 participants