Skip to content

The result of pvc memory usage is not religious #1381

@zhujian7

Description

@zhujian7

Cyclone use du -sh to get memory usage, read the annotation of -h for du command:

-h "Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.

Please pay attention to the unit : Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte. Instead of Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte.

Unfortunately, we use the following formula to calculate:

var unitMap = map[byte]int64{
	'B': 1,
	'K': 1024,
	'M': 1024 * 1024,
	'G': 1024 * 1024 * 1024,
	'T': 1024 * 1024 * 1024 * 1024,
}

And It is obviously wrong, since 1 Mebibyte=1000Kibibyte (1M=1000K).

There are two ways to fix it:

  • correct the formula from 1 Mebibyte=**1024**Kibibyte to 1 Mebibyte=**1000**Kibibyte
  • find a way to get PVC usage with Kibibyte, Mebibyte unit.

Related Reads:

/kind bug

What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:
@supereagle @hyy0322 @qiuxiaolian

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