Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move v4 task metadata handler to ecs-agent module #3733

Merged
merged 8 commits into from
Jun 7, 2023

Conversation

amogh09
Copy link
Contributor

@amogh09 amogh09 commented Jun 2, 2023

Summary

Add v4 task metadata handler to ecs-agent module and consume it in agent module. The new handler provides the same functionality as the current handler in agent module, however, it is more generic and better decouples Agent state from the HTTP handler logic.

Also add ClockDrift and EphemeralStorageMetrics optional fields to v4 Task Metadata response model. These fields are not supported by ECS Agent and it won't be populating them. However, they are supported by Fargate Agent and we want to add them here for consistency.

Note that the current v4 task metadata handler in agent module is not being removed in this PR as it is used for taskWithTags endpoint. We will remove it when we add taskWithTags support to ecs-agent module in future.

Implementation details

  • Add TaskMetadataHandler function to ecs-agent/tmds/handlers/v4 package. This is the v4 task metadata handler function.
  • Add GetTaskMetadata method to AgentState interface. The handler uses this method to get task metadata from Agent in v4 format.
  • Implement GetTaskMetadata method for TMDSAgentState struct in agent module. This struct implements AgentState interface.
  • Update TMDS setup in agent to use v4 task metadata handler from ecs-agent module.
  • Add new ClockDrift and EphemeralStorageMetrics structs to ecs-agent/tmds/handlers/v4 package and add them as optional fields to v4 TaskResponse.

Testing

Test driven development practice was followed and unit tests for task metadata endpoints were improved in #3722 as a part of that. The improved unit tests, existing integration tests, and existing functional tests are passing.

In addition to automated tests, regression, stress, and performance testing was performed manually. For manual testing, Agent was built and run on an EC2 instance from the source in this PR. Another EC2 instance was provisioned with Agent v1.71.1.

Manual regression testing was done by calling v4 task metadata endpoints on the two instances for the same task (two replicas under a service), and the responses were compared using diff. No regression was detected.

For stress testing, v4 task metadata endpoint was called on both instances at 3000 rps for 30 seconds. 100% success rate was achieved on both instances and no significant differences were seen in the throughput (both instances achieved ~3000 rps throughput).

For performance testing, profiling data was collected for heap and cpu usage from the two Agents while stress testing (same rate and duration as for stress testing above) v4 task metadata endpoints. No significant differences were seen in CPU and heap usage.

New tests cover the changes: yes

Description for the changelog

Move v4 task metadata handler to ecs-agent module

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@amogh09 amogh09 marked this pull request as ready for review June 2, 2023 22:40
@amogh09 amogh09 requested a review from a team as a code owner June 2, 2023 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants