提交 9a14699e 编写于 作者: C Chuansheng Lu 提交者: Jonathan Lu

[MultiTenant] Added -XX:+TenantCpuThrottling -XX:+TenantCpuAccounting

Summary: added two new options to support tenant cpu controlling

Test Plan: jdk/test/multi-tenant

Reviewed-by: yuleil, superajun-wsj

Issue: https://github.com/alibaba/dragonwell8/issues/84
上级 70a7d2cc
...@@ -351,6 +351,7 @@ ...@@ -351,6 +351,7 @@
template(type_name, "type") \ template(type_name, "type") \
template(findNative_name, "findNative") \ template(findNative_name, "findNative") \
template(initializeTenantContainerClass_name, "initializeTenantContainerClass") \ template(initializeTenantContainerClass_name, "initializeTenantContainerClass") \
template(initializeJGroupClass_name, "initializeJGroupClass") \
template(deadChild_name, "deadChild") \ template(deadChild_name, "deadChild") \
template(addClass_name, "addClass") \ template(addClass_name, "addClass") \
template(throwIllegalAccessError_name, "throwIllegalAccessError") \ template(throwIllegalAccessError_name, "throwIllegalAccessError") \
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#define TENANT_FLAG_MULTI_TENANT_ENABLED (0x1) // bit 0 to indicate if the tenant feature is enabled. #define TENANT_FLAG_MULTI_TENANT_ENABLED (0x1) // bit 0 to indicate if the tenant feature is enabled.
#define TENANT_FLAG_HEAP_THROTTLING_ENABLED (0x2) // bit 1 to indicate if heap throttling feature is enabled. #define TENANT_FLAG_HEAP_THROTTLING_ENABLED (0x2) // bit 1 to indicate if heap throttling feature is enabled.
#define TENANT_FLAG_CPU_THROTTLING_ENABLED (0x4) // bit 2 to indicate if cpu throttling feature is enabled.
#define TENANT_FLAG_CPU_ACCOUNTING_ENABLED (0x40) // bit 6 to indicate if cpu accounting feature is enabled.
#define TENANT_FLAG_HEAP_ISOLATION_ENABLED (0x80) // bit 7 to indicate if heap isolation feature is enabled. #define TENANT_FLAG_HEAP_ISOLATION_ENABLED (0x80) // bit 7 to indicate if heap isolation feature is enabled.
static jint tenant_GetTenantFlags(TenantEnv *env, jclass cls); static jint tenant_GetTenantFlags(TenantEnv *env, jclass cls);
...@@ -59,5 +61,13 @@ tenant_GetTenantFlags(TenantEnv *env, jclass cls) ...@@ -59,5 +61,13 @@ tenant_GetTenantFlags(TenantEnv *env, jclass cls)
result |= TENANT_FLAG_HEAP_ISOLATION_ENABLED; result |= TENANT_FLAG_HEAP_ISOLATION_ENABLED;
} }
if (TenantCpuThrottling) {
result |= TENANT_FLAG_CPU_THROTTLING_ENABLED;
}
if (TenantCpuAccounting) {
result |= TENANT_FLAG_CPU_ACCOUNTING_ENABLED;
}
return result; return result;
} }
...@@ -105,6 +105,12 @@ ...@@ -105,6 +105,12 @@
\ \
product(bool, TenantHeapThrottling, false, \ product(bool, TenantHeapThrottling, false, \
"Enable heap throttling per tenant") \ "Enable heap throttling per tenant") \
\
product(bool, TenantCpuThrottling, false, \
"Enable cpu throttling per tenant") \
\
product(bool, TenantCpuAccounting, false, \
"Enable cpu accounting per tenant") \
//add new AJVM specific flags here //add new AJVM specific flags here
......
...@@ -1078,6 +1078,16 @@ static void call_initializeTenantContainerClass(TRAPS) { ...@@ -1078,6 +1078,16 @@ static void call_initializeTenantContainerClass(TRAPS) {
vmSymbols::void_method_signature(), CHECK); vmSymbols::void_method_signature(), CHECK);
} }
static void call_initializeJGroupClass(TRAPS) {
assert(TenantCpuThrottling || TenantCpuAccounting, "TenantCpuThrottling or TenantCpuAccounting disabled");
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::com_alibaba_tenant_JGroup(), true, CHECK);
instanceKlassHandle klass (THREAD, k);
JavaValue result(T_VOID);
JavaCalls::call_static(&result, klass, vmSymbols::initializeJGroupClass_name(),
vmSymbols::void_method_signature(), CHECK);
}
char java_runtime_name[128] = ""; char java_runtime_name[128] = "";
char java_runtime_version[128] = ""; char java_runtime_version[128] = "";
...@@ -3964,6 +3974,12 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { ...@@ -3964,6 +3974,12 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
} }
} }
if (MultiTenant && (TenantCpuThrottling || TenantCpuAccounting)) {
// JGroup initialization may involve complex steps
// have to do that after full JVM initialization
call_initializeJGroupClass(CHECK_0);
}
create_vm_timer.end(); create_vm_timer.end();
#ifdef ASSERT #ifdef ASSERT
_vm_complete = true; _vm_complete = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册