lower the cpu cost in open-source mini-mode
This commit is contained in:
		| @ -15,6 +15,7 @@ | |||||||
| #include "rpc/obrpc/ob_rpc_proxy.h" | #include "rpc/obrpc/ob_rpc_proxy.h" | ||||||
| #include "rpc/obrpc/ob_rpc_proxy_macros.h" | #include "rpc/obrpc/ob_rpc_proxy_macros.h" | ||||||
| #include "lib/utility/ob_unify_serialize.h" | #include "lib/utility/ob_unify_serialize.h" | ||||||
|  | #include "lib/ob_running_mode.h" | ||||||
| #include "common/ob_partition_key.h" | #include "common/ob_partition_key.h" | ||||||
| #include "election/ob_election_group_id.h" | #include "election/ob_election_group_id.h" | ||||||
| #include "share/config/ob_server_config.h" | #include "share/config/ob_server_config.h" | ||||||
| @ -38,7 +39,11 @@ enum { | |||||||
| inline int64_t get_batch_delay_us(const int batch_type) | inline int64_t get_batch_delay_us(const int batch_type) | ||||||
| { | { | ||||||
|   int64_t delay[BATCH_REQ_TYPE_COUNT] = {2 * 1000, 2 * 1000, 1 * 1000, 0, 20, 0, 0, 0, 5 * 1000}; |   int64_t delay[BATCH_REQ_TYPE_COUNT] = {2 * 1000, 2 * 1000, 1 * 1000, 0, 20, 0, 0, 0, 5 * 1000}; | ||||||
|   return (batch_type >= 0 && batch_type < BATCH_REQ_TYPE_COUNT) ? delay[batch_type] : 0; |   int64_t delay_us = (batch_type >= 0 && batch_type < BATCH_REQ_TYPE_COUNT) ? delay[batch_type] : 0; | ||||||
|  |   if (lib::is_mini_mode()) { | ||||||
|  |     delay_us *= 100; | ||||||
|  |   } | ||||||
|  |   return delay_us; | ||||||
| } | } | ||||||
|  |  | ||||||
| inline int64_t get_batch_buffer_size(const int batch_type) | inline int64_t get_batch_buffer_size(const int batch_type) | ||||||
|  | |||||||
| @ -88,6 +88,8 @@ void ObLockWaitMgr::destroy() | |||||||
|  |  | ||||||
| void ObLockWaitMgr::run1() | void ObLockWaitMgr::run1() | ||||||
| { | { | ||||||
|  |   const int interval_us = (lib::is_mini_mode() ? 10 : 1000) * 1000; | ||||||
|  |  | ||||||
|   (void)prctl(PR_SET_NAME, "ObLockWaitMgr", 0, 0, 0); |   (void)prctl(PR_SET_NAME, "ObLockWaitMgr", 0, 0, 0); | ||||||
|   while (!has_set_stop() || !is_hash_empty()) { |   while (!has_set_stop() || !is_hash_empty()) { | ||||||
|     ObLink* iter = check_timeout(); |     ObLink* iter = check_timeout(); | ||||||
| @ -97,7 +99,7 @@ void ObLockWaitMgr::run1() | |||||||
|       (void)repost(cur); |       (void)repost(cur); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     usleep(10000); |     usleep(interval_us); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 hnwyllmm
					hnwyllmm