Skip to content

aws-ecs: Support MaxSwap and Swappiness in LinuxParameters #18460

@joelchen

Description

@joelchen

Description

Please support MaxSwap (https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/cfnspec/spec-source/specification/000_cfn/000_official/000_AWS_ECS.json#L975) and Swappiness (https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/cfnspec/spec-source/specification/000_cfn/000_official/000_AWS_ECS.json#L987) in LinuxParameters (https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts).

Use Case

Using swap allows the container to write excess memory requirements to disk when the container has exhausted all the RAM that is available to it.

Proposed Solution

export interface LinuxParametersProps {
  /**
   * Specifies whether to run an init process inside the container that forwards signals and reaps processes.
   *
   * @default false
   */
  readonly initProcessEnabled?: boolean;

  /**
   * The value for the size (in MiB) of the /dev/shm volume.
   *
   * @default No shared memory.
   */
  readonly sharedMemorySize?: number;

  /**
   * The total amount of swap memory (in MiB) a container can use.
   *
   * @default No swap.
   */
  readonly maxSwap?: number;

  /**
   * This allows you to tune a container's memory swappiness behavior.
   *
   * @default 60
   */
  readonly swappiness?: number;
}

constructor(scope: Construct, id: string, props: LinuxParametersProps = {}) {
  super(scope, id);

  this.sharedMemorySize = props.sharedMemorySize;
  this.initProcessEnabled = props.initProcessEnabled;
  this.maxSwap = props.maxSwap;
  this.swappiness = props.swappiness;
}

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic Containereffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions