Skip to content

Worker pool stats broken #4

@martinsumner

Description

@martinsumner

When a worker is checked out from a pool (i.e. through a call to riak_core_worker_pool:poolboy_checkout/3 the timestamp of the checkout is updated on the list of checkouts. A queue_time stat is updated by comparing the time the job was added to the queue with now.

When a worker is checked back into the pool (i.e. through a call to riak_core_worker_pool:poolboy_checkin/4, a work_time stat is updated by comparing the checkout time for this pid with now.

However, if work is completed, and there is work queued handle_event({checkin, Worker} bypasses the poolboy_checkin/4 and poolboycheckout/3 functions, and simply allocates the next work in the queue directly to the checked in process.

This means when there is a large queue, and workers are continually recycled fresh work - the stats no longer make sense. For example, only when the queue is emptied will the work_time be recorded, and this will not be the time for the individual piece of work but the time since the worker first became busy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions