Skip to content

Commit e50bc3a

Browse files
author
Bhavik Kumar
committed
Add hard memory limits and gc collection
1 parent 7d80625 commit e50bc3a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ENV APP_CONTEXT "${APPLICATION_CONTEXT}"
1010

1111
CMD ["ntpd", "-s"]
1212
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.servlet.context-path=/${APP_CONTEXT}", \
13-
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap","-jar", "/app.jar"]
13+
"-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap","-jar", "/app.jar"]
1414

1515
HEALTHCHECK --start-period=90s \
1616
CMD wget --quiet --tries=1 --spider --timeout=30 http://localhost:8080/${APP_CONTEXT}/1/ping || exit 1

deployment/templates/service.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Metadata:
1616
- ContainerName
1717
- DesiredCount
1818
- CPUReservation
19+
- MemoryLimit
1920
- MemoryReservation
2021
- HealthCheckGracePeriodSeconds
2122
- ApplicationContext
@@ -55,6 +56,11 @@ Parameters:
5556
Default: 1024
5657
AllowedValues: [20, 128, 256, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096]
5758

59+
MemoryLimit:
60+
Type: Number
61+
Default: 1024
62+
AllowedValues: [20, 128, 256, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096]
63+
5864
CPUReservation:
5965
Type: Number
6066
Default: 128
@@ -147,6 +153,7 @@ Resources:
147153
Image: !Join ['', ["Fn::Sub": '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/', "Fn::ImportValue": {"Fn::Sub":'${AWS::StackName}-RepositoryName'}, ':latest']]
148154
Essential: true
149155
Cpu: !Ref CPUReservation
156+
Memory: !Ref MemoryLimit
150157
MemoryReservation: !Ref MemoryReservation
151158
PortMappings:
152159
- ContainerPort: 8080

0 commit comments

Comments
 (0)