- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
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
1. Deploy Infrastructure:
Backend (Java) Containerization
Backend Profiling
1. Configure Async-Profiler
Continuous profiling results on Amazon S3
Continuous Profiling graph
Frontend Monitoring
1. Install Angular DevTools
Add Chrome DevTools extension for Angular performance monitoring
Enable performance tracking in your Angular application:
Backend Performance Analysis
1. CPU Profiling:
1. Use Chrome Dev-Tools:
2. Angular-Specific Metrics:
Integrated Monitoring Setup
1.Configure Grafana Dashboard:
Performance Data Visualization
1. Create Custom Dashboards:
1. Analyze Bottlenecks:
2. Implement Improvements:
3. Verify Improvements:
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.
The choice between on-demand profiling and continuous profiling depends on your goals -
Use on-demand profiling during development, testing, or when debugging known issues.
Use continuous profiling in production for proactive performance management, especially in complex or high-traffic systems.
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:
2. Configure Container Registry:Using eksctl to create EKS cluster
eksctl create cluster — name full-stack-cluster — region your-region
- Create repositories in Amazon ECR for both frontend and backend images
- Push your container images to ECR
Backend (Java) Containerization
Frontend (Angular) ContainerizationFROM 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”]
3. Performance Monitoring SetupFROM 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/
Backend Profiling
1. Configure Async-Profiler
2. Enable Continuous Profilingdeployment.yaml
spec:
containers:
— name: backend
env:
— name: JAVA_TOOL_OPTIONS
value: “-agentpath:/async-profiler/libasyncProfiler.so=start,event=cpu,file=/tmp/profile.html”
volumeMounts:
— name: profiles
mountPath: /tmp/profiles
volumes:
— name: profiles
persistentVolumeClaim:
claimName: s3-profile-storage
Continuous profiling results on Amazon S3
Continuous Profiling graph
Frontend Monitoring
1. Install Angular DevTools
Add Chrome DevTools extension for Angular performance monitoring
Enable performance tracking in your Angular application:
4. Data Collection and Analysis// main.ts
if (environment.production) {
enableProdMode();
if (window) {
window.console.log = () => {};
}
}
Backend Performance Analysis
1. CPU Profiling:
2. Memory Analysis:Access the pod
kubectl exec -it — /bin/bash
Start profiling
jcmd 1 AsyncProfiler:start,event=cpu,file=/tmp/cpu-profile.html
Frontend Performance AnalysisHeap allocation profiling
jcmd 1 AsyncProfiler:start,event=alloc,file=/tmp/heap-profile.html
1. 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
Integrated Monitoring Setup
1.Configure Grafana Dashboard:
2. Set up Prometheus:grafana-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
spec:
template:
spec:
containers:
— name: grafana
image: grafana/grafana
- Deploy Prometheus for metrics collection
- Configure scrape targets for both frontend and backend
Performance Data Visualization
1. Create Custom Dashboards:
- Backend metrics (response times, CPU usage)
- Frontend metrics (page load times, component performance)
- End-to-end transaction traces
1. Analyze Bottlenecks:
- Review Flame Graphs from Async-Profiler
- Check Angular Dev-Tools 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
Conclusion:Remove profiling data
kubectl exec -it — rm /tmp/profile.html
Delete monitoring resources
kubectl delete -f grafana-deployment.yaml
kubectl delete -f prometheus-deployment.yaml
Delete EKS cluster
eksctl delete cluster — name full-stack-cluster
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.
The choice between on-demand profiling and continuous profiling depends on your goals -
Use on-demand profiling during development, testing, or when debugging known issues.
Use continuous profiling in production for proactive performance management, especially in complex or high-traffic systems.