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

Track execute() and enqueue() tasks separately from scheduled tasks. #2645

Merged

Commits on Feb 13, 2024

  1. Track execute() and enqueue() tasks separately from scheduled tasks.

    Motivation:
    
    `SelectableEventLoop` uses `ScheduledTask` to track tasks scheduled for some
    specific point in time, but also tasks that are supposed to be executed immediately.
    
    This casuse performance issues where the number of immediate tasks grows, as
    they need to be kept sorted in the `_scheduledTasks` `PriorityQueue`. Additionally,
    that datastructure is protected by lock(s) which casues lock contention from
    other threads.
    
    Finally, immediate tasks differ from future scheduled tasks in that they don't have
    a `failFn` to handle destruction at the end of `SelectableEventLoop.run()` execution.
    
    Modifications:
    
    * Modify `ScheduledTask` to only track closure tasks and require `failFn` to be provided.
    * Retain `UnderlyingTask` for tracking closure or `ErasedUnownedJob` for async-await tasks.
    * Add `SelectableEventLoop._immediateTasks` to track immediate tasks (collection of `UnderlyingTask`-s).
    * Split production / consumption of the tasks to match the datastructure changes described above.
    * Modify the `defer` block of `SelectableEventLoop.run()` to execute immediate tasks, instead of dropping them silently.
    
    Result:
    
    Performance of workloads relying on queuing lots of tasks gets better.
    gmilos committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    5751d70 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1b7ad7d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9237e57 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a51573a View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2024

  1. Comment rewrite

    gmilos committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    83f378c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f76e65b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b792b90 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a504c38 View commit details
    Browse the repository at this point in the history
  5. Update Sources/NIOPosix/SelectableEventLoop.swift

    Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
    gmilos and weissi authored Feb 14, 2024
    Configuration menu
    Copy the full SHA
    e3d4edc View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Configuration menu
    Copy the full SHA
    c40f0c2 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2024

  1. Configuration menu
    Copy the full SHA
    6b893ca View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Configuration menu
    Copy the full SHA
    3f66019 View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'gmilos/gm-selectableeventloop-job-queue…

    …ing-optimisations' into gm-selectableeventloop-job-queueing-optimisations
    gmilos committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    b36f381 View commit details
    Browse the repository at this point in the history
  3. Merge remote-tracking branch 'origin/main' into gm-selectableeventloo…

    …p-job-queueing-optimisations
    gmilos committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    7b55f61 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8b818e6 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c7a6ece View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Bump allocation count for scheduling_10000_executions to account for …

    …Deque growth properties
    gmilos committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    4fb9f15 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b8861d9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7555cc5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e829497 View commit details
    Browse the repository at this point in the history