Skip to content

Object endpoints: measuring after every call costs CPU; module endpoints and 401 headers left open #32

Closed

Description

@thorwhalen

Follow-ups from the adversarial review of #31 (fix for #30), deferred there:

  • Measuring costs time on every call. Class and instance endpoints walk the object, up to max_obj_size bytes of it, after every dispatched call, reads included. A read on a 10k-entry dict (575 KB) costs about 15 ms. One option is an obj_mutators= handler option that limits measuring to the names declared as mutating, while keeping the current "measure everything" as the default. Another is to throttle measuring.
  • Lazy results are measured too early. A method that returns a generator or a coroutine does its work after the measure, so the overshoot is only caught by the next call. That is documented in Instance endpoints need an obj_owner and are bounded in size (#30) #31, not fixed.
  • Module endpoints. A module exposed through attr_names has no owner hook and no size bound. Its functions can mutate module globals. The same is true of a bound method passed straight into an app spec.
  • 401 responses from bottle_error_handler carry no WWW-Authenticate header (RFC 7235). Which scheme to name depends on the deployment's auth (JWT middleware, obj_owner).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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