elastic / elastic/apm-agent-java

OpenJDK CRaC support

Open
#2,982 7 comments 4 reactions 1 assignee Claimed by @jackshirazi View on GitHub
agent-java community stretch
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

## Is your feature request related to a problem?

AWS announced support of snapstart in AWS Lambda based on Java runtime.
It looks like this support based on OpenJDK CRaC, with ability to specify before/after context restore hooks, reference:
https://aws.amazon.com/blogs/compute/reducing-java-cold-starts-on-aws-lambda-functions-with-snapstart/
https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html#snapstart-compatibility

However if java agent attached before snapshot created, I think it will lead to incorrect results (as least sending APM data with same instance metadata).

## Describe the solution you'd like

Ideally, we would like to bytebuddy instrumentation happen before snapshot is took.
In afterRestore method, java agent should be able re update only necessary instance specific information

## Describe alternatives you've considered

Attaching agent in afterRestore hook, however it returns back initialisation latency

## Additional context

Implementing and providing CRaC restore hook may be useful not only for AWS Lambda application, but for any java application using CRaC project.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.