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

查询tdengine 内存逐步增大 #30202

Open
lulifa opened this issue Mar 17, 2025 · 8 comments
Open

查询tdengine 内存逐步增大 #30202

lulifa opened this issue Mar 17, 2025 · 8 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@lulifa
Copy link

lulifa commented Mar 17, 2025

在我的net程序中,我用原生的方式连接tdengine,客户端和服务端版本都是:3.2.3.0

Image

具体代码如下

Image

Image

Image

这样会产生一个问题就是tdengine 我前端页面每隔30s 定时查询接口刷新,会同时调用5-6个接口查询tdengine 随着时间的推移,内存逐渐增大,cpu也会直接飙升,相关的对象我上面代码都释放了 我想问下,这种问题如何解决?

Image

@lulifa lulifa added help wanted Extra attention is needed question Further information is requested labels Mar 17, 2025
@hoilung
Copy link

hoilung commented Mar 20, 2025

盲猜一波,应该是你的连接资源没有释放,一直在新建连接,从数据库看看连接数

@lulifa
Copy link
Author

lulifa commented Mar 20, 2025

盲猜一波,应该是你的连接资源没有释放,一直在新建连接,从数据库看看连接数

我using 这个connection了 连接注册为单例模式 连接资源都释放了 上面图中都using了

@lulifa
Copy link
Author

lulifa commented Mar 20, 2025

盲猜一波,应该是你的连接资源没有释放,一直在新建连接,从数据库看看连接数
是这样查看连接数么?
Image

@hoilung
Copy link

hoilung commented Mar 20, 2025

Image
查看这个表

@lulifa
Copy link
Author

lulifa commented Mar 20, 2025

Image 查看这个表

我一天内到目前的时间内 有13967这些连接数 业务场景: 我每30s页面会自动刷新请求后台的数据,有的页面可能会一次性查60次表 获取相关的数据,如果同时几个人打开的话 可能就会更多

Image

Image

@lulifa
Copy link
Author

lulifa commented Mar 20, 2025

Image 这个获取连接打开 没有用异步方式OpenAsync() 批量高频查询的时候 线程阻塞了?

@hoilung
Copy link

hoilung commented Mar 21, 2025

Image 这个获取连接打开 没有用异步方式OpenAsync() 批量高频查询的时候 线程阻塞了?

和异步应该没有关系,数据库连接的表是实时的,就说明你一直创建连接,如果你关闭程序表里应该是没有你的记录

  1. using之前手动调用下关闭试试
  2. 或者改用一个单例连接保持连接,不要反复打开关闭,在排查看看

@lulifa
Copy link
Author

lulifa commented Mar 21, 2025

Image 这个获取连接打开 没有用异步方式OpenAsync() 批量高频查询的时候 线程阻塞了?

和异步应该没有关系,数据库连接的表是实时的,就说明你一直创建连接,如果你关闭程序表里应该是没有你的记录

  1. using之前手动调用下关闭试试
  2. 或者改用一个单例连接保持连接,不要反复打开关闭,在排查看看

我后续试试 感谢感谢 如有问题 再打扰咨询下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants