Skip to content

Excessive memory pressure during cookbook upload #77

@alekc

Description

@alekc

Describe the bug
While doing a migration from Chef to Goiardi, we encountered a significant memory issue during knife upload cookbooks/
(We are running multiple pod with s3&postgresql)

image

image

heap.out.zip

By the look of it there are at least several points which should be looked into

  • Usage of Decoder instead of unmarshal (https://ahmet.im/blog/golang-json-decoder-pitfalls/)
  • Usage in general of json package for unmarshalling. Right now we are using anonymous object, if we were able to define expected input/output objects, we could use easyjson
  • By the first look of it, most of the issues (at least in our case) are happening because on every upload we read and decode every cookbook in our db, it might be better provide a support for caching of some sort (possibly storing a flag which would be altered on every op which alters cookbook state. If (on reading cookbooks) the flag has not changed, then cookbooks would reflect whats in memory.

@ctdk your thoughts about it? Do you know if there are any kind of rfc for request/response objects of chef?

p.s. the dropdown you see in graph is because container is oom killed and restarted.
Also, in our case, rss usage potentially might be caused by https://golang.org/doc/go1.12#runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions