Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check idle tasklist to include active task writers #916

Merged
merged 3 commits into from
Jul 3, 2018
Merged

Conversation

vancexu
Copy link
Contributor

@vancexu vancexu commented Jun 30, 2018

Currently in matching getTaskPump there is a timer to check whether tasklist is "idle" and need to recycle. But it only treat no poller within 5 min as idle to recycle.

This PR add check idle to include if there are tasks added recently (5 min).

The default live time it currently hardcoded as 5 min for both poller and writer. Which can be make configurable if necessary.

@@ -338,6 +343,7 @@ func (c *taskListManagerImpl) Start() error {
c.taskWriter.Start()
c.signalNewTask()
go c.getTasksPump()
go c.checkIdle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a separate goroutine for idle check? why can't be done in the same pump like we do for zero pollers check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, previously because I try to avoid this check potentially block getTaskPump

@@ -949,3 +969,16 @@ func (c *taskContext) completeTask(err error) {
func createServiceBusyError(msg string) *s.ServiceBusyError {
return &s.ServiceBusyError{Message: msg}
}

func (c *taskListManagerImpl) updateLastAddTaskTime() {
c.lastAddTaskTimeLock.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do this without adding another lock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with better solution in getTaskPump

@@ -51,6 +51,8 @@ const (
const (
_defaultTaskDispatchRPS = 100000.0
_defaultTaskDispatchRPSTTL = 60 * time.Second

maxAddTasksIdleTime = 5 * time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert this to a config knob.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vancexu vancexu merged commit a9a3727 into master Jul 3, 2018
@vancexu vancexu deleted the tl branch July 3, 2018 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants