Skip to content

Fix memory issues with caller rrd - #7201

Open
cplaursen wants to merge 3 commits into
xapi-project:masterfrom
cplaursen:fix/rrd-not-enough-memory
Open

Fix memory issues with caller rrd#7201
cplaursen wants to merge 3 commits into
xapi-project:masterfrom
cplaursen:fix/rrd-not-enough-memory

Conversation

@cplaursen

Copy link
Copy Markdown
Contributor

This PR addresses issues arising from unbounded, automatic caller registration and reporting of every caller in the following ways:

  • Impose a limit of 100 auto-registered callers, configurable with xapi.conf key max-auto-registered-callers. A limit of 0 disables auto-registering, and a negative limit is treated as unlimited.
  • Only publish rrd datasources for groups (manually labelled callers), rather than for individual callers.
  • Publish a debug line with caller information whenever a rate limit is triggered

Currently, the number of auto-registered callers is unbounded. This commit adds
a default bound of 100, after which the caller which hasn't made a request in
the longest time is evicted.

The number can be configured with xapi.conf key "max-auto-registered-callers".
Setting this number to 0 disables auto-registering, and setting it to a
negative value removes the cap.

Signed-off-by: Christian Pardillo Laursen <christian.pardillolaursen@citrix.com>
Registering every caller to the RRD is causing out-of-memory issues. We resolve
this by only publishing groups rather than individual callers - this also
allows users to define their own reporting groups based on their needs.

Signed-off-by: Christian Pardillo Laursen <christian.pardillolaursen@citrix.com>
Signed-off-by: Christian Pardillo Laursen <christian.pardillolaursen@citrix.com>
Comment thread ocaml/xapi/xapi_caller.ml
; pattern_key: Caller_table.Key.pattern_key
; stats: Caller_statistics.t
; rate_limit_ref: API.ref_Rate_limit
; auto_registered: bool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think we should promote a auto_registered caller from true to false when admin links a rate_limit rule to it?

Comment thread ocaml/xapi/xapi_caller.ml
~client_ip ~pattern_key =
~client_ip ~pattern_key ~auto_registered =
match Caller_table.get_exact caller_table ~pattern:pattern_key with
| Some entry ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here. If admin creates caller matches a auto-registered caller, should change its auto_registered flag?

@changlei-li changlei-li left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few nits for your reference.

Comment thread ocaml/xapi/xapi_caller.ml
( Rrd.Host
, Ds.ds_make
~name:(Printf.sprintf "caller_%s_tokens" uuid)
~name:(Printf.sprintf "group_%s_tokens" group)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

group name is passed by admin. Is it harmful in ds name if there is space, special characters or excessive length

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