This content originally appeared on DEV Community and was authored by Amogh Deshpande
Analyzing the performance of a full-stack application (Java and Angular) running on Amazon EKS requires a combined approach, as async-profiler is primarily focused on the Java backend. Async-Profiler is a low-overhead sampling profiler for Java applications running on the HotSpot JVM. For the Angular frontend, you’ll primarily rely on browser developer tools and potentially some Angular-specific profiling techniques. Container startup performance presents a significant challenge for Java-angular applications running on Kubernetes, particularly during scaling events and recovery scenarios.
Performance profiling in containerized Java applications has long presented significant challenges. Async-profiler, a lightweight sampling solution that offers an interesting approach for Java workloads running on Amazon Elastic Kubernetes Service (Amazon EKS). Eliminating traditional Safepoint bias issues enables more accurate performance analysis.
To analyze Java application performance with async-profiler in Amazon EKS (Elastic Kubernetes Service), need to follow below steps —
1. Environment Setup
Prerequisites
- AWS Account with EKS access
- Java 21 Spring Boot backend application
- Angular frontend application
- AWS Cloud-Shell for environment bootstrapping
- Amazon EKS cluster
- Initial Setup Steps
1. Deploy Infrastructure:
Using eksctl to create EKS cluster
eksctl create cluster — name full-stack-cluster — region your-region
2. Configure Container Registry:
- Create repositories in Amazon ECR for both frontend and backend images
- Push your container images to ECR
2. Application Containerization
Backend (Java) Containerization
FROM openjdk:21-jdk AS builder
WORKDIR /app
COPY . /app
RUN ./mvnw clean package
FROM openjdk:21-jre
RUN apt-get update && apt-get install -y async-profiler
COPY — from=builder /app/target/app.jar /app/app.jar
ENTRYPOINT [“java”, “-agentpath:/async-profiler/libasyncProfiler.so=start,event=cpu,file=/tmp/profile.html”, “-jar”, “/app/app.jar”]
Frontend (Angular) Containerization
FROM node:latest AS builder
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build — prod
FROM nginx:alpine
COPY — from=builder /app/dist/* /usr/share/nginx/html/
3. Performance Monitoring Setup
Backend Profiling
Configure Async-Profiler
deployment.yaml
spec:
containers:
— name: backend
env:
— name: JAVA_TOOL_OPTIONS
value: “-agentpath:/async-profiler/libasyncProfiler.so=start,event=cpu,file=/tmp/profile.html”
2. Enable Continuous Profiling
volumeMounts:
— name: profiles
mountPath: /tmp/profiles
volumes:
— name: profiles
persistentVolumeClaim:
claimName: s3-profile-storage
Frontend Monitoring
Install Angular DevTools
Add Chrome DevTools extension for Angular performance monitoring
Enable performance tracking in your Angular application:
// main.ts
if (environment.production) {
enableProdMode();
if (window) {
window.console.log = () => {};
}
}
4. Data Collection and Analysis
Backend Performance Analysis
CPU Profiling:
Access the pod
kubectl exec -it — /bin/bash
Start profiling
jcmd 1 AsyncProfiler:start,event=cpu,file=/tmp/cpu-profile.html
- Memory Analysis:
Heap allocation profiling
jcmd 1 AsyncProfiler:start,event=alloc,file=/tmp/heap-profile.html
Frontend Performance Analysis
Use Chrome Dev-Tools:
Open Chrome Dev-Tools (F12)
Navigate to Performance tab
Record page load and user interactions
2. Angular-Specific Metrics:
Monitor change detection cycles
Track component render times
Analyze bundle sizes
5. Visualization and Monitoring
Integrated Monitoring Setup
Configure Grafana Dashboard:
grafana-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
spec:
template:
spec:
containers:
— name: grafana
image: grafana/grafana
2. Set up Prometheus:
Deploy Prometheus for metrics collection
Configure scrape targets for both frontend and backend
Performance Data Visualization
Create Custom Dashboards:
Backend metrics (response times, CPU usage)
Frontend metrics (page load times, component performance)
End-to-end transaction traces
6. Optimization Process
1. Analyze Bottlenecks:
Review Flame Graphs from Async-Profiler
Check Angular DevTools reports
Examine end-to-end transaction traces
2. Implement Improvements:
Optimize database queries
Implement caching where appropriate
Reduce bundle sizes
Optimize Angular change detection
3. Verify Improvements:
Re-run profiling after changes
Compare before/after metrics
Monitor user experience metrics
7. Cleanup
Remove profiling data
kubectl exec -it — rm /tmp/profile.html
Delete monitoring resources
kubectl delete -f grafana-deployment.yaml
kubectl delete -f prometheus-deployment.yamlDelete EKS cluster
eksctl delete cluster — name full-stack-cluster
Conclusion:
Async-Profiler is a powerful tool for profiling Java applications, identifying performance bottlenecks such as high CPU usage, memory leaks, and inefficient thread execution.
For Angular, browser-based profiling tools like Chrome DevTools help uncover slow rendering, excessive API calls, and unnecessary change detection cycles.
Automating profiling and integrating it into CI/CD pipelines ensures ongoing performance health and early detection of regressions.
By combining Async-Profiler, Angular debugging techniques, and AWS observability tools, teams can proactively improve performance, reduce latency, and optimize cloud resources for a smoother user experience.
This content originally appeared on DEV Community and was authored by Amogh Deshpande

Amogh Deshpande | Sciencx (2025-05-18T13:59:17+00:00) How to analyze Java application performance with async-profiler in Amazon EKS. Retrieved from https://www.scien.cx/2025/05/18/how-to-analyze-java-application-performance-with-async-profiler-in-amazon-eks/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.