optimize the query response time performance
This commit is contained in:
		
				
					committed by
					
						
						wangzelin.wzl
					
				
			
			
				
	
			
			
			
						parent
						
							29ee400113
						
					
				
				
					commit
					0cb4c948c8
				
			@ -71,7 +71,7 @@ int ObRSTUtility::setup(uint base)
 | 
				
			|||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ObRSTTimeCollector::ObRSTTimeCollector():mutex_()
 | 
					ObRSTTimeCollector::ObRSTTimeCollector()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    flush();
 | 
					    flush();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -81,8 +81,8 @@ ObRSTTimeCollector::~ObRSTTimeCollector()
 | 
				
			|||||||
int ObRSTTimeCollector::flush()
 | 
					int ObRSTTimeCollector::flush()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    for(int i = 0; i < OB_QRT_OVERALL_COUNT + 1; i++) {
 | 
					    for(int i = 0; i < OB_QRT_OVERALL_COUNT + 1; i++) {
 | 
				
			||||||
        count_[i] = 0;
 | 
					        ATOMIC_SET(&count_[i], 0);
 | 
				
			||||||
        total_[i] = 0;
 | 
					        ATOMIC_SET(&total_[i], 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -92,8 +92,8 @@ int ObRSTTimeCollector::collect(uint64_t time)
 | 
				
			|||||||
    int i = 0;
 | 
					    int i = 0;
 | 
				
			||||||
    for(int count = utility_.bound_count(); count > i; ++i) {
 | 
					    for(int count = utility_.bound_count(); count > i; ++i) {
 | 
				
			||||||
        if(utility_.bound(i) > time) {
 | 
					        if(utility_.bound(i) > time) {
 | 
				
			||||||
            count_[i]++;
 | 
					            ATOMIC_INC(&count_[i]);
 | 
				
			||||||
            total_[i] += time;
 | 
					            ATOMIC_FAA(&total_[i],time);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -140,7 +140,6 @@ int ObRSTCollector::collect_query_response_time(uint64_t tenant_id, uint64_t tim
 | 
				
			|||||||
        if (OB_FAIL(ret = collector_map_.get_refactored(tenant_id, time_collector))){
 | 
					        if (OB_FAIL(ret = collector_map_.get_refactored(tenant_id, time_collector))){
 | 
				
			||||||
          SERVER_LOG(WARN, "time collector of the tenant does not exist", K(tenant_id), K(time), K(ret));
 | 
					          SERVER_LOG(WARN, "time collector of the tenant does not exist", K(tenant_id), K(time), K(ret));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            lib::ObMutexGuard guard(time_collector->mutex_);
 | 
					 | 
				
			||||||
            if(OB_FAIL(ret = time_collector->collect(time))){
 | 
					            if(OB_FAIL(ret = time_collector->collect(time))){
 | 
				
			||||||
                SERVER_LOG(WARN, "time collector of the tenant collect time failed", K(tenant_id), K(time), K(ret));
 | 
					                SERVER_LOG(WARN, "time collector of the tenant collect time failed", K(tenant_id), K(time), K(ret));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -163,7 +162,6 @@ int ObRSTCollector::flush_query_response_time(uint64_t tenant_id,const ObString&
 | 
				
			|||||||
        if (OB_FAIL(ret = collector_map_.get_refactored(tenant_id, time_collector))){
 | 
					        if (OB_FAIL(ret = collector_map_.get_refactored(tenant_id, time_collector))){
 | 
				
			||||||
            SERVER_LOG(WARN, "time collector of the tenant does not exist", K(ret), K(tenant_id));
 | 
					            SERVER_LOG(WARN, "time collector of the tenant does not exist", K(ret), K(tenant_id));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            lib::ObMutexGuard guard(time_collector->mutex_);
 | 
					 | 
				
			||||||
            if (OB_FAIL(ret = time_collector->setup(tenant_config->query_response_time_range_base))){
 | 
					            if (OB_FAIL(ret = time_collector->setup(tenant_config->query_response_time_range_base))){
 | 
				
			||||||
                SERVER_LOG(WARN, "time collector of the tenant set range base failed", K(ret), K(tenant_id));
 | 
					                SERVER_LOG(WARN, "time collector of the tenant set range base failed", K(ret), K(tenant_id));
 | 
				
			||||||
            } else if (OB_FAIL(ret = time_collector->flush())){
 | 
					            } else if (OB_FAIL(ret = time_collector->flush())){
 | 
				
			||||||
 | 
				
			|||||||
@ -69,7 +69,6 @@ class ObRSTTimeCollector {
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ObRSTUtility utility_;
 | 
					  ObRSTUtility utility_;
 | 
				
			||||||
  lib::ObMutex mutex_;
 | 
					 | 
				
			||||||
  uint32_t count_[OB_QRT_OVERALL_COUNT];
 | 
					  uint32_t count_[OB_QRT_OVERALL_COUNT];
 | 
				
			||||||
  uint64_t total_[OB_QRT_OVERALL_COUNT];
 | 
					  uint64_t total_[OB_QRT_OVERALL_COUNT];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user