Skip to content

When I try to get data by days the memory went high. #2

@wudixiaotie

Description

@wudixiaotie

The query is

<<"SELECT avg('057345b6-76b1-4a40-aac9-139818'.'cpu'.'usage' BUCKET 'zone', 1d) AS 'cpu-usage', avg('057345b6-76b1-4a40-aac9-139818'.'cpu'.'effective' BUCKET 'zone', 1d) AS 'cpu-effective', avg('057345b6-76b1-4a40-aac9-139818'.'cpu'.'nwait' BUCKET 'zone', 1d) AS 'cpu-nwait', avg(divide('057345b6-76b1-4a40-aac9-139818'.'mem'.'usage' BUCKET 'zone', 1048576), 1d) AS 'memory-usage', avg(divide('057345b6-76b1-4a40-aac9-139818'.'mem'.'value' BUCKET 'zone', 1048576), 1d) AS 'memory-value', avg(divide('057345b6-76b1-4a40-aac9-139818'.'swap'.'usage' BUCKET 'zone', 1048576), 1d) AS 'swap-usage', avg(divide('057345b6-76b1-4a40-aac9-139818'.'swap'.'value' BUCKET 'zone', 1048576), 1d) AS 'swap-value', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'net'.'net0'.'opackets64' BUCKET 'zone'), 1d) AS 'net-send-ops-net0', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'net'.'net0'.'ipackets64' BUCKET 'zone'), 1d) AS 'net-recv-ops-net0', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'net'.'net0'.'obytes64' BUCKET 'zone'), 1d) AS 'net-send-b-net0', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'net'.'net0'.'ibytes64' BUCKET 'zone'), 1d) AS 'net-recv-b-net0', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'zfs'.'nread' BUCKET 'zone'), 1d) AS 'zfs-read-b', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'zfs'.'nwritten' BUCKET 'zone'), 1d) AS 'zfs-write-b', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'zfs'.'reads' BUCKET 'zone'), 1d) AS 'zfs-read-ops', avg(derivate('057345b6-76b1-4a40-aac9-139818'.'zfs'.'writes' BUCKET 'zone'), 1d) AS 'zfs-write-ops' LAST 30d">>.

Then the memory of the beam suddenly goes extramly high, Almost 1G.
I saw the code. Maybe because ddb sends all the data to the dflow, and dfow will create many temporary data terms in memory during data gathering and processing. So there alway a Wave crest of the memory usage of beam, then all the sub-query processes will terminated, the beam will GC itself.
What can I do if these long-term query is very frequently to be use? Just expanded memory?
Is there a way to limit the memory usage? Or I need to cache the result in Redis or something like that?

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