You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@linkis.apache.org by zhaoyuan <15...@163.com> on 2022/04/29 07:16:23 UTC

[DISCUSSION] why Insert data separately with lock

Xi:

有没有人知道,这里为什么要分开加锁,一次往数据库里插多条锁是不是可行呢

@peacewong@WDS 




Xi:

DefaultResourceManager这个类




peacewong@WDS:

感觉是可行的,但是需要考虑多个锁被占用的问题,我觉得可以优化下。有意向的话可以提个LKIP下




peacewong@WDS:

现在这里你们遇到了性能问题吗?




Xi:

是的,同一个用户大量提交executeOnce任务时,启动会很慢




Xi:

锁的争抢影响比较小,主要是锁住之后的操作比较费时




Xi:

100个任务现在大概延迟6分钟左右




peacewong@WDS:

锁住之后主要是做资源加减,应该会响应很快才对?有定位卡在哪里吗




Xi:

平均下来基本上申请的时候一个会消耗400ms左右,释放的时候700ms左右




peacewong@WDS:

可以加些日志看看卡在哪里吗?这里应该可以优化下的。主要是数据库相关的操作







Xi:

Does anyone know why locks should be added separately here? Is it feasible to insert multiple locks into the database at one time

@ peacewong@WDS  




Xi:

Defaultresourcemanager class




peacewong@WDS :

I think it is feasible, but the problem that multiple locks are occupied needs to be considered. I think it can be optimized. If you are interested, you can mention an lkip




peacewong@WDS :

Are you experiencing performance problems here now?




Xi:

Yes, when the same user submits a large number of executeonce tasks, the startup will be very slow




Xi:

The impact of lock contention is relatively small, mainly because the operation after locking is time-consuming




Xi:

100 missions are now about six minutes late




peacewong@WDS :

After locking, it is mainly about adding and subtracting resources. It should respond quickly? Is there a location card




Xi:

On average, it will consume about 400ms when applying and about 700ms when releasing




peacewong@WDS :

Can you add some logs to see where the card is? This should be optimized. Mainly database related operations