Skip to content

Commit 71613db

Browse files
committed
debug
1 parent cd553fb commit 71613db

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

terraform/java/ec2/asg/main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ resource "aws_launch_configuration" "launch_configuration" {
105105
sudo yum install java-${var.language_version}-amazon-corretto -y
106106
fi
107107
108+
# enable ec2 instance connect for debug
109+
sudo yum install ec2-instance-connect -y
110+
108111
# Copy in CW Agent configuration
109112
agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'
110113
echo $agent_config > amazon-cloudwatch-agent.json
@@ -128,12 +131,14 @@ resource "aws_launch_configuration" "launch_configuration" {
128131
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
129132
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \
130133
OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id} \
131-
nohup java -jar main-service.jar &> nohup.out &
134+
nohup java -jar -XX:+UseG1GC main-service.jar &> nohup.out &
132135
133136
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
134137
sleep 30
135138
136139
# Deploy Traffic Generator
140+
141+
" " \
137142
sudo yum install nodejs aws-cli unzip tmux -y
138143
139144
# Bring in the traffic generator files to EC2 Instance
@@ -224,7 +229,7 @@ resource "null_resource" "remote_service_setup" {
224229
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
225230
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \
226231
OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \
227-
nohup java -jar remote-service.jar &> nohup.out &
232+
nohup java -XX:+UseG1GC -jar remote-service.jar &> nohup.out &
228233
229234
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
230235
sleep 30

terraform/java/ec2/default/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ resource "null_resource" "main_service_setup" {
140140
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
141141
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \
142142
OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id} \
143-
nohup java -jar main-service.jar &> nohup.out &
143+
nohup java -XX:+UseG1GC -jar main-service.jar &> nohup.out &
144144
145145
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
146146
sleep 30
@@ -206,6 +206,9 @@ resource "null_resource" "remote_service_setup" {
206206
sudo yum install java-${var.language_version}-amazon-corretto -y
207207
fi
208208
209+
# enable ec2 instance connect for debug
210+
sudo yum install ec2-instance-connect -y
211+
209212
# Copy in CW Agent configuration
210213
agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'
211214
echo $agent_config > amazon-cloudwatch-agent.json
@@ -229,7 +232,7 @@ resource "null_resource" "remote_service_setup" {
229232
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
230233
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \
231234
OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \
232-
nohup java -jar remote-service.jar &> nohup.out &
235+
nohup java -XX:+UseG1GC -jar remote-service.jar &> nohup.out &
233236
234237
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
235238
sleep 30

0 commit comments

Comments
 (0)