AWS Big Data Blog
Amazon EMR now provides up to 30% lower cost and up to 15% improved performance for Spark workloads on Graviton2-based instances
Amazon EMR now supports M6g, C6g and R6g instances with Amazon EMR versions 6.1.0, 5.31.0 and later. These instances are powered by AWS Graviton2 processors that are custom designed by AWS using 64-bit Arm Neoverse cores to deliver the best price performance for cloud workloads running in Amazon Elastic Compute Cloud (Amazon EC2). On Graviton2 instances, Amazon EMR runtime for Apache Spark provides up to 15% improved performance at up to 30% lower costs relative to equivalent previous generation instances. In our TPC-DS 3 TB benchmark tests, we found that queries run up to 32 times faster using Amazon EMR runtime for Apache Spark. For more information, see Amazon EMR introduces EMR runtime for Apache Spark.
You can use Apache Spark for a wide array of analytics use cases ranging from large-scale transformations to streaming, data science, and machine learning. Amazon EMR provides the latest, stable, open-source innovations, performant storage with Amazon S3, and the unique cost savings capabilities of Spot Instances and Managed Scaling.
Amazon EMR runtime for Apache Spark is a performance-optimized runtime environment for Apache Spark, available and turned on by default on Amazon EMR release 5.28.0 and later. Amazon EMR runtime for Apache Spark provides 100% API compatibility with open-source Apache Spark. This means that your Apache Spark workloads run faster and incur lower compute costs when run on Amazon EMR without requiring any changes to your application.
In this post, we discuss the results that we observed by running Spark workloads on Graviton2 instances.
AWS Graviton2 and Amazon EMR runtime performance improvements
To measure improvements, we ran TPC-DS 3 TB benchmark queries on Amazon EMR 5.30.1 using Amazon EMR runtime for Apache Spark (compatible with Apache Spark version 2.4) with 5-10 node clusters of M6g instances with data in Amazon Simple Storage Service (Amazon S3) and compared it to equivalent configuration using M5 instances. We measured performance improvements using total query execution time and geometric mean of query execution time across the 104 TPC-DS 3 TB benchmark queries.
The results showed improved performance on M6g instance EMR clusters compared to equivalent M5 instance EMR clusters of between 11.61–15.61% improvement in total query runtime for different sizes within the instance family, and between 10.52–12.91% improvement in geometric mean. To measure cost improvement, we added up the Amazon EMR and Amazon EC2 cost per instance per hour and multiplied it by the total query runtime. We observed between 21.58–30.58% reduced instance hour cost on M6g instance EMR clusters compared equivalent M5 instance EMR clusters to execute the 104 TPC-DS benchmark queries.
The following table shows results from running TPC-DS 3 TB benchmark queries using Amazon EMR 5.30.1 over equivalent M5 and M6g instance EMR clusters.
Instance Size | 16 XL | 12 XL | 8 XL | 4 XL | 2 XL |
Number of core instances in EMR cluster | 5 | 5 | 5 | 5 | 10 |
Total query runtime on M5 (seconds) | 6157 | 6167 | 6857 | 10593 | 10676 |
Total query runtime on M6g (seconds) | 5196 | 5389 | 6061 | 9313 | 9240 |
Total query execution time improvement with M6g | 15.61% | 12.63% | 11.61% | 12.08% | 13.45% |
Geometric mean query execution time on M5 (sec) | 33 | 34 | 35 | 47 | 47 |
Geometric mean query execution time on M6g (sec) | 29 | 30 | 32 | 41 | 42 |
Geometric mean query execution time improvement with M6g | 12.73% | 10.79% | 10.52% | 12.91% | 11.24% |
EC2 M5 instance price ($ per hour) | $3.072 | $2.304 | $1.536 | 0.768 | 0.384 |
EMR M5 instance price ($ per hour) | $0.27 | $0.27 | $0.27 | 0.192 | 0.096 |
(EC2 + EMR) M5 instance price ($ per hour) | $3.342 | $2.574 | $1.806 | $0.960 | $0.480 |
Cost of running on M5 ($ per instance) | $5.72 | $4.41 | $3.44 | $2.82 | $1.42 |
EC2 M6g instance price ($ per hour) | $2.464 | $1.848 | $1.232 | $0.616 | $0.308 |
EMR M6g price ($ per hour per instance) | $0.616 | $0.462 | $0.308 | $0.15 | $0.08 |
(EC2 + EMR) M6g instance price ($ per hour) | $3.080 | $2.310 | $1.540 | $0.770 | $0.385 |
Cost of running on M6g ($ per instance) | $4.45 | $3.46 | $2.59 | $1.99 | $0.99 |
Total cost reduction with M6g including performance improvement | -22.22% | -21.58% | -24.63% | -29.48% | -30.58% |
The following graph shows per query improvements observed on M6g 2XL instances with EMR Runtime for Spark on Amazon EMR version 5.30.1 compared to equivalent M5 2XL instances for the 104 queries in the TPC-DS 3 TB benchmark. Performance of 100 of 104 TPC-DS queries improved with M6g 2XL, and performance for 4 queries regressed (q41, q20, q42, and q52 – with the maximum regression of -20.99%). If you are evaluating migrating from M5 instances to M6g instances for EMR Spark workloads, we recommend that you test your workloads to check if any of your queries encounter slower performance.
R6g instances showed a similar performance improvement while running Apache Spark workloads compared to equivalent R5 instances. Our test results showed between 14.27-21.50% improvement in total query runtime for 5 different instance sizes within the instance family, and between 12.48-18.95% improvement in geometric mean. On cost comparison, we observed 23.26%-31.66% reduced instance hour cost on R6g instance EMR clusters compared to R5 EMR instance clusters to execute the 104 TPC-DS benchmark queries. We observed 4 benchmark queries (q6, q21, q41 and q26 – with a maximum regression of -18.28%) taking longer to execute on R6g instance clusters compared to R5 instance clusters.
With C6g instances, we observed improved performance compared to C5 instances for Spark workloads on 2XL, 4XL, 12XL and 16XL instance sizes. Query execution performance regressed on 8XL instances by -0.38%. We observed between 16.84-24.15% lower instance hour costs on C6g instance EMR clusters compared equivalent C5 EMR instance clusters to execute the 104 TPC-DS benchmark queries. Performance of 73 of 104 TPC-DS queries improved with C6g 4XL, and performance for 31 queries regressed (with a maximum regression of -31.38% for q78).
Summary
By using Amazon EMR with M6g, C6g and R6g instances powered by Graviton2 processors, we observed improved performance and reduced cost of running 104 TPC-DS benchmark queries. To keep up to date, subscribe to the Big Data blog’s RSS feed to learn about more Apache Spark optimizations, configuration best practices, and tuning advice.
About the Authors
Peter Gvozdjak is a senior engineering manager for EMR at Amazon Web Services.
Al MS is a product manager for Amazon EMR at Amazon Web Services.