[ECS] [Fargate]: nitro backed tasks
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Tell us about your request I'd like to be able to run Fargate tasks on a nitro hypervisor.
Which service(s) is this request for? Fargate
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
I'm trying to run the NewRelic APM inside a Fargate task. For timing purposes, it uses RDTSC which relies on the system clocksource. A vDSO backed clock works quickly and adds little overhead to my application. The Xen hypervisor clocksource xen does not support vDSO and therefore makes NewRelic APM unusable as the RDTSC calls are extremely slow.
The Nitro hypervisor uses kvm-clock as the default clocksource which does support vDSO and works with NewRelic APM perfectly.
Are you currently working around this issue? We've chosen not to deploy NewRelic APM on Fargate. We've considered switching to EC2 launch type since we can pick a nitro instance.
Additional context
On an EC2 instance you can change the clocksource but inside a Fargate task the /sys filesystem is readonly so you're stuck with xen despite the fact other clock sources are available.
Out of curiosity, how did New Relic APM work pre-Nitro/KVM? I don't remember it adding that much overhead back in the early-to-mid 2010s in the pre-Nitro days on my Xen-backed hardware.
@otterley the PHP APM doesn't work on Xen-backed at all (technically it does work but it's unusably slow) unless you can change the clocksource. This is doable on a standalone EC2 instance as you're not prevented from changing anything with the system/kernel. Xen-backed on Fargate is the real issue as you can't modify/change this.
Additionally, NewRelic's different APM agents have different ways of determining time so not all of them are subject to this issue on Fargate. Only the agents which depend on RDTSC (node, for example, doesn't) have this problem.
Only the agents which depend on RDTSC (node, for example, doesn't) have this problem.
Ah, that might explain it, since I was running Ruby applications at the time. Thanks for the insight!
any updates?
As of November 2021 Fargate on ECS supports Graviton. All Graviton instances use the Nitro architecture. So, if you select the arm64 architecture for your task, it will run on Graviton, and you'll be able to take advantage of the Nitro-related performance enhancements. Most PHP code runs on Graviton without issue. In addition, the pricing for running on Graviton is 20% less per task-hour than the x86 equivalent.
Closing as there is a solution for most users. (Obviously anyone requiring x86 wouldn't have this option but having confirmation from AWS that there is a way to ensure a generic PHP app can use NewRelic's PHP APM on fargate solves the original issue.
For others reading this, I think x86 support is there now as well
cat /sys/devices/system/clocksource/clocksource0/current_clocksource tsc
running on an x86 fargate container