[ 
https://issues.apache.org/jira/browse/TS-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13611749#comment-13611749
 ] 

John Plevyak commented on TS-1405:
----------------------------------

I think depending on the delay is brittle.  You can never tell how long a 
thread will be delayed in an overloaded system, and the delay increases memory 
pressure.  Rather I would remove the delay, moving the line

+  event_cancel_list_head = (Event *) ink_atomiclist_popall(&event_cancel_list);

above the loop in process_cancel_event() (and remove the time test).

Then I would move the assignment of cancelled = true into set_event_cancel:

if (!e->canceled) {
  if (e->in_the_priority_queue && (e->timeout_at - e->ethread->cur_time) > 
HRTIME_SECONDS(event_cancel_limit)) {
    /* prevent more threads cancel one event racing */
    e->cancelled = true;
    ink_atomiclist_push(&event_cancel_list, e);
  } else
    e->cancelled = true;
}

In fact, I would just incorporate the code in set_event_cancel into 
cancel_event() since it is only called in one place.

So, I agree, that the delay would most likely have prevented a problem, but I 
think it would be better to not have it, because when future programmers see a 
constant delay, they might be tempted to decrease it to the point when problems 
might occur.
                
> apply time-wheel scheduler  about event system
> ----------------------------------------------
>
>                 Key: TS-1405
>                 URL: https://issues.apache.org/jira/browse/TS-1405
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2.0
>            Reporter: Bin Chen
>            Assignee: Bin Chen
>             Fix For: 3.3.2
>
>         Attachments: linux_time_wheel.patch, linux_time_wheel_v2.patch, 
> linux_time_wheel_v3.patch, linux_time_wheel_v4.patch, 
> linux_time_wheel_v5.patch, linux_time_wheel_v6.patch, 
> linux_time_wheel_v7.patch, linux_time_wheel_v8.patch
>
>
> when have more and more event in event system scheduler, it's worse. This is 
> the reason why we use inactivecop to handler keepalive. the new scheduler is 
> time-wheel. It's have better time complexity(O(1))

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to