问题描述:如何在DB2服务器上限制某个用户使用的CPU?
方法参考如下:
db2 attach to <实例名>
db2 update dbm cfg using WLM_DISPATCHER yes
db2 detach
db2 connect to <数据库名>
db2 "create service class APPUSER_SUPERCLASS CPU LIMIT 20"
db2 "create workload APPUSER_WORKLOAD SYSTEM_USER ('APPUSER') SESSION_USER ('APPUSER') SERVICE CLASS APPUSER_SUPERCLASS"
其中service class的名子和 workload的名子随便起。APPUSER是用户的名子
如果需要修改CPU limit
db2 "alter service class APPUSER_SUPERCLASS CPU LIMIT 80"
查看定义:
db2look -d <数据库名> -wlm
另外,如果想看应用有没有用上预期的workload,可以查看db2pd -apinfo输出中的Workload ID,然后在syscat.workloads中根据该ID查看对应的workload名子,services class名子。
参考资料:
https://www.sohu.com/a/194174498_151779