You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/12/08 01:31:05 UTC

[GitHub] [dolphinscheduler] mgduoduo opened a new issue #7256: [Improvement][dolphinscheduler-api] Optimization for task instances query

mgduoduo opened a new issue #7256:
URL: https://github.com/apache/dolphinscheduler/issues/7256


   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
   
   
   ### Description
   
   The action ```/projects/{projectCode}/task-instances``` is very slow,  
   ![image](https://user-images.githubusercontent.com/13417113/145129958-3bf0e76f-c611-4c12-a312-0d9123b3e1a5.png)
   
   Total count of table ```t_ds_task_instance``` is only 100, 000 +.
   
   Below is the query sql for the action.
   ``` sql
   select
           // ...
           process.name as process_instance_name
           from t_ds_task_instance instance
           left join t_ds_task_definition_log define on define.code=instance.task_code and define.version=instance.task_definition_version
           left join t_ds_process_instance process on process.id=instance.process_instance_id
           where define.project_code = #{projectCode}
          // ...
   ```
   
   I have 2 sugguestions for the performance optimization.
   1. create a index for table ```t_ds_task_definition_log``` on column ```code```,
   the query performance is improved obvisouly.
   ![image](https://user-images.githubusercontent.com/13417113/145131412-932b3579-9573-4f16-b4ae-e4a7eb1f4fbe.png)
   
   2. the logic could be optimized in org.apache.dolphinscheduler.api.service.impl.TaskInstanceServiceImpl#queryTaskListPaging.
   ``` java
   for (TaskInstance taskInstance : taskInstanceList) {
               taskInstance.setDuration(DateUtils.format2Duration(taskInstance.getStartTime(), taskInstance.getEndTime()));
               // TODO it could be optimized here.
               User executor = usersService.queryUser(taskInstance.getExecutorId());
               if (null != executor) {
                   taskInstance.setExecutorName(executor.getUserName());
               }
           }
   ```
   such as assemble an user map ```Map<Long, User> userMap``` outside of the loop.
   
   
   ### Use case
   
   improve the query performance.
   
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [dolphinscheduler] mgduoduo commented on issue #7256: [Improvement][dolphinscheduler-api] Optimization for task instances query

Posted by GitBox <gi...@apache.org>.
mgduoduo commented on issue #7256:
URL: https://github.com/apache/dolphinscheduler/issues/7256#issuecomment-991414363


   I will solve the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [dolphinscheduler] mgduoduo commented on issue #7256: [Improvement][dolphinscheduler-api] Optimization for task instances query

Posted by GitBox <gi...@apache.org>.
mgduoduo commented on issue #7256:
URL: https://github.com/apache/dolphinscheduler/issues/7256#issuecomment-992042935


   https://github.com/apache/dolphinscheduler/pull/7331 this is the PR, pls check and merge it if works, tks. @calvinjiang 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [dolphinscheduler] mgduoduo commented on issue #7256: [Improvement][dolphinscheduler-api] Optimization for task instances query

Posted by GitBox <gi...@apache.org>.
mgduoduo commented on issue #7256:
URL: https://github.com/apache/dolphinscheduler/issues/7256#issuecomment-991414363


   I will solve the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #7256: [Improvement][dolphinscheduler-api] Optimization for task instances query

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #7256:
URL: https://github.com/apache/dolphinscheduler/issues/7256#issuecomment-988411222


   Hi:
   * Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
   * In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
   * If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/en-us/community/development/subscribe.html ,Then write the issue URL in the email content and send question to dev@dolphinscheduler.apache.org.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org