Troubleshooting and Optimization Flashcards

1
Q

A developer is instrumenting an application that will be hosted in a large On-Demand EC2 instance in AWS. All of the downstream calls invoked by the application must be traced properly, including the AWS SDK calls. A user-defined data should also be present to expedite the troubleshooting process.

Which of the following are valid considerations in AWS X-Ray that the developer should follow?

A

You can use the “metadata” field in the segment section to add custom data for your tracing. If you want to trace all the AWS SDK calls of your application, then you can add a subsegment and set the “namespace” field to “AWS”. Alternatively, you can set the “namespace” value to “remote” if you want to trace other downstream calls.

Hence, the valid considerations in this scenario are:

  • Set the namespace subsegment field to aws for AWS SDK calls and remote for other downstream calls.
  • Set the metadata object with any additional custom data that you want to store in the segment.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you send sement documents directly to X-Ray?

A

using the PutTraceSegments API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

X-Ray compiles and processes segment documents to generate queryable trace summaries and full traces that you can access via what APIs?

A

GetTraceSummaries and BatchGetTraces, respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Where would you add user-defined data in an X-Ray Segment?

A

The metadata field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the options for the “namespace” field in the Subsegment?

A

“AWS” is for AWS SDK calls and “remote” is for other downstream calls.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between X-Ray “annotations” and “metadata” fields?

A

Both can be used in Segment and Subsegments. annotations object is a key-value pairs that you want X-Ray to index for search while metadata object is used to store any additional data that you want to store in the segment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are X-Ray inferred segments?

A

using data from the subsegments, they can be generated and added to the full trace.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RDS Read Replica vs. ElastiCache Cluster?

A

RDS Read Replicas provide enhanced performance and durability for the database (DB) instances. This feature makes it easy to elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads. You can create one or more replicas of a given source DB Instance and serve high-volume application read.
You can reduce the load on your source DB instance by routing read queries from your applications to the read replica. Read replicas allow you to elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads.

ElatiCache will improve the read performance of the application, this solution entails a lot of code changes in the application as compared with just using RDS Read Replicas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a CloudWatch namespace?

A

a container for CloudWatch metrics. Metrics in different namespaces are isolated from each other so that metrics from different applications are not mistakenly aggregated into the same statistics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a CloudWatch dimension?

A

CloudWatch dimension is only a name/value pair that is part of the identity of a metric.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What would you set in Step Functions worker to define the heartbeat interval and the retry policy?

A

HeartbeatSeconds and Retry.MaxAttempts, repectively.

The HeartbeatSeconds attribute defines the maximum interval that the task will wait for a heartbeat signal. If an activity worker fails to send heartbeats within this interval, the state is failed. A retry policy on the state allows another activity worker to attempt to complete the
stale.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you want to monitor the memory and swap usage of the instance and the number of idle and running processes as well. How would you do it?

A

Install Cloudwatch Logs agent to the EC2 instance. This will collect both system metrics and log files from Amazon EC2 instances and on-premises servers. The agent supports both Windows Server and Linux, and enables you to select the metrics to be collected, including sub-resource metrics such as per-CPU core. Aside from the usual metrics, it also tracks the memory, swap, and disk space utilization metrics of your server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

AWS Distro for OpenTelemetry vs. X-Ray?

A

It is recommended to instrument your application with the AWS Distro for OpenTelemetry if you need the following:

-The ability to send traces to multiple different tracing backends without having to re-instrument your code

-Support for a large number of library instrumentations for each language, maintained by the OpenTelemetry community

-Fully managed Lambda layers that package everything you need to collect telemetry data without requiring code changes when using Java, Python, or Node.js

It is recommended to choose an X-Ray SDK for instrumenting your application if you need the following:

-A tightly integrated single-vendor solution

-Integration with X-Ray centralized sampling rules, including the ability to configure sampling rules from the X-Ray console and automatically use them across multiple hosts, when using Node.js, Python, Ruby, or .NET

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is CloudWatch Namespace?

A

A namespace is a container for CloudWatch metrics. Metrics in different namespaces are isolated from each other, so that metrics from different applications are not mistakenly aggregated into the same statistics.

There is no default namespace. You must specify a namespace for each data point you publish to CloudWatch. You can specify a namespace name when you create a metric.

The AWS namespaces typically use the following naming convention: AWS/service. For example, Amazon EC2 uses the AWS/EC2 namespace.
AWS/ApiGateway , AWS/AppFlowetc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is CloudWatch Dimensions?

A

A dimension is a name/value pair that is part of the identity of a metric. Because dimensions are part of the unique identifier for a metric, whenever you add a unique name/value pair to one of your metrics, you are creating a new variation of that metric. For example, many Amazon EC2 metrics publish InstanceId as a dimension name, and the actual instance ID as the value for that dimension.

You can assign up to 30 dimensions to a metric.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a CloudWatch Metric?

A

Metrics are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time. For example, the CPU usage of a particular EC2 instance is one metric provided by Amazon EC2. The data points themselves can come from any application or business activity from which you collect data.

17
Q

PutMetricData vs. PutMetricStream

A

PutMetricData publishes metric data points to Amazon CloudWatch. CloudWatch associates the data points with the specified metric. If the specified metric does not exist, CloudWatch creates the metric. When CloudWatch creates a metric, it can take up to fifteen minutes for the metric to appear in calls to ListMetrics.

You can publish either individual data points in the Value field, or arrays of values and the number of times each value occurred during the period by using the Values and Counts fields in the MetricDatum structure. Using the Values and Counts method enables you to publish up to 150 values per metric with one PutMetricData request, and supports retrieving percentile statistics on this data.

PutMetricStream creates or updates a metric stream. Metric streams can automatically stream CloudWatch metrics to AWS destinations, including Amazon S3, and to many third-party solutions.

18
Q

What is CloudFormation Mappings?

A

The optional Mappings section matches a key to a corresponding set of named values. For example, if you want to set values based on a region, you can create a mapping that uses the region name as a key and contains the values you want to specify for each specific region

e.g. amis for each region
Mappings:
RegionMap:
us-east-1:
“HVM64”: “ami-0ff8a91507f77f867”
us-west-1:
“HVM64”: “ami-0bdb828fd58c52235”
eu-west-1:
“HVM64”: “ami-047bb4163c506cd98”
ap-southeast-1:
“HVM64”: “ami-08569b978cc4dfa10”
ap-northeast-1:
“HVM64”: “ami-06cd52961ce9f0d85”

19
Q

What is CloudFormation Transform?

A

The optional Transform section specifies one or more macros that AWS CloudFormation uses to process your template. The Transform section builds on the simple, declarative language of AWS CloudFormation with a powerful macro system.

You can declare one or more macros within a template. AWS CloudFormation executes macros in the order that they’re specified.

For example, in the template sample below, AWS CloudFormation evaluates MyMacro and then AWS::Serverless, both of which can process the contents of the entire template because of their inclusion in the Transform section.

// Start of processable content for MyMacro and AWS::Serverless
Transform:
- MyMacro
- ‘AWS::Serverless’
Resources:
WaitCondition:
Type: ‘AWS::CloudFormation::WaitCondition’
MyBucket:
Type: ‘AWS::S3::Bucket’
Properties:
BucketName: MyBucket
Tags: [{“key”:”value”}]
CorsConfiguration:[]
MyEc2Instance:
Type: ‘AWS::EC2::Instance’
Properties:
ImageID: “ami-123”

20
Q

What is CloudFormation Metadata?

A

You can use the optional Metadata section to include arbitrary JSON or YAML objects that provide details about the template.

e.g.
Metadata:
Instances:
Description: “Information about the instances”
Databases:
Description: “Information about the databases”

21
Q

What is CloudFormation Resources section?

A

The ONLY REQUIRED SECTION is Resources section declares the AWS resources that you want to include in the stack, such as an Amazon EC2 instance or an Amazon S3 bucket.

e.g.
Resources:
MyEC2Instance:
Type: “AWS::EC2::Instance”
Properties:
ImageId: “ami-0ff8a91507f77f867”

22
Q

What is CloudFormation Parameters?

A

Use the optional Parameters section to customize your templates. Parameters enable you to input custom values to your template each time you create or update a stack.

e.g.

Parameters:
InstanceTypeParameter:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- m1.small
- m1.large
Description: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.

23
Q

Name common Errors.

A

502 Bad Gateway - most likely the cause is an incompatible output returned from a Lambda proxy integration backend.

503 service unavailable.is a server-side error. It means that something is going wrong with the software running on the server and often indicates a performance issue.

504 Error means API Gateway has timed out.
The API requests are reaching the maximum integration timeout for API Gateway (29 seconds) application not responding. Is it the web server or db server?

404 error -
does requested object exist?
have access to it?
request is correctly formed?

429 error - too many requests

24
Q

An application developer finds that performing a scan operation on a large DynamoDB table is taking a long time to execute. What can be used to improve the performance and decrease the execution time of the scan operation?

A

Use of parallel scans

Parallel scans can be used by multiple worker threads in an application to perform a scan of a DynamoDB table much faster.

25
Q

How would you make your application that uses multiple services be traced by X-Ray?

A

You can send trace data to X-Ray in the form of segment documents. A segment document is a JSON formatted string that contains information about the work that your application does in service of a request. Your application can record data about the work that it does itself in segments or work that uses downstream services and resources in subsegments.

A segment document can be up to 64 kB and contain a whole segment with subsegments, a fragment of a segment that indicates that a request is in progress, or a single subsegment that is sent separately. You can send segment documents directly to X-Ray by using the PutTraceSegments API. An alternative is, instead of sending segment documents to the X-Ray API, you can send segments and subsegments to an X-Ray daemon, which will buffer them and upload to the X-Ray API in batches. The X-Ray SDK sends segment documents to the daemon to avoid making calls to AWS directly. This is the correct option among the choices.

26
Q
A