SlideShare a Scribd company logo
1 of 50
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
B u i l d i n g a P h o t o r e a l i s t i c R e a l - t i m e 3 D C o n f i g u r a t o r
w i t h S e r v e r - s i d e R e n d e r i n g s o n A W S
C l a u d i o B r e d f e l d t – C T O - M Y C S
C h r i s t o p h K a s s e n – S o l u t i o n s A r c h i t e c t - A W S
A R C 4 0 5
D e c e m b e r 1 , 2 0 1 7
AWS re:INVENT
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What can you expect?
• Introduction to 3D configurators
• Rendering on AWS
• Integrate 3D into your web application
• Customer story—mycs
Our expectations
• Knowledge of AWS services
• 3D visualization basics
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
3D configurators
A b r i e f i n t r o d u c t i o n
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Real-time configurators
Cars, fashion, furniture...
Benefits
• Engage with customers
• Visualize final product
• Support buying decision
Server-side rendering
• Quality
• Speed
• Low cost
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rasterizers
• Composing vectors/polygons
• OpenGL/DirectX
• GPU accelerated
Ray tracing
• Send traces through scene
• Photorealistic images
• GPGPU-optimized
• CUDA or OpenCL
3D rendering
Image
View ray
Shadow ray
Camera
Light source
Scene object
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rendering on AWS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
P3
1-8 GPUs
NVIDIA Tesla V100
Volta architecture
1x GPU core
5,120 CUDA cores, 640 tensor cores
16 GB HBM2
Intel Xeon E5-2686 v4 (Broadwell)
ENA adapter
G3
1-4 GPUs
NVIDIA Tesla M60
Maxwell architecture
2x GPU cores
4096 CUDA cores
16 GB GDDR5
Intel Xeon E5-2686 v4 (Broadwell)
ENA adapter
AWS GPU instances
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic GPU—key features
Flexible instance size and attachment
• Right-size instance selection
• Utilize Auto Scaling to handle requests
Windows instances only
OpenGL 4.2 support
• No CUDA, OpenCL, and DirectX support
• Ensure application runs on OpenGL
rendering
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic GPU—operations
Elastic GPU ENI consumes additional IP
Rendering max. 25 fps
Use GPU Caps Viewer to view OpenGL extensions
Troubleshooting
Display framerate
C:Program FilesAmazonEC2ElasticGPUsconfeg.conf
[Application]
show_fps=1
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do I choose?
Instance P3
Supports:
OpenGL 4.5, DirectX 12.1
CUDA 9.0+, OpenCL 1.2+
G3
Supports:
OpenGL 4.5, DirectX 12.0
CUDA 8.0+, OpenCL 1.2
Elastic GPU
Supports:
OpenGL 4.2
Use cases Machine learning
Computational finance,
genomics...
3D visualizations
3D rendering
Video encoding....
Applications benefiting
from some GPU
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
3D rendering in web apps
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Integrate rendering into web apps
What do we need?
• Rendering API
• Web app/microservices
• Renderer
• 3D model and model configuration
• Caching
Other requirements
• (Near) real-time rendering
• High-quality rendered images
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rendering
Rasterizer
• Unity
• Amazon Lumberyard
Ray tracer
• Nvidia Iray, 3ds max…
• Cycles (Blender)
Integrate engine
• Write image to file
• Grab framebuffer
• Utilize native integration
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
import bpy, _cycles
print(_cycles.available_devices())
bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.cycles.device = 'GPU'
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
# Larger tile sizes optimal for GPU processing
bpy.context.scene.render.tile_x = 256
bpy.context.scene.render.tile_y = 256
Ray tracing with Blender
Run Blender from the CLI
blender -b ~/blender/model.blend -o ~/blender/tmp/ 
-P ~/blender/gpu_settings.py -f 1
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ray tracer on GPU instances
Auto-scaled services and rendering API
Network Load Balancer (NLB)
• Stream images with http/2 push
• TCP level load-balancer
Serve pre-rendered assets via CDN
Caching
• Utilize CloudFront caching
• Rendering API
• Custom caching for http/2
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rasterizer with Elastic GPU
Auto Scaling
• Only a single fleet of instances
• Instances right-sized
• Elastic GPU attached
Rasterizer engine, e.g. Unity
Caching
• Pre-rendered assets
• Request contains 3D model
configuration
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Operations
Monitor GPU utilization
• GPU instances use nvidia-smi to query data
• Elastic GPU memory usage
Custom CloudWatch metrics from rendering API
Auto Scaling
• Scale GPU fleet based on custom metrics
• Scale up aggressively
• Scale down slowly
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon CloudWatch metrics
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
#!/bin/bash
NAMESPACE='GPU/Metrics' # Metrics namespace
# Fetch GPU metrics
IFS=', ' read -r -a STATS <<< `nvidia-smi --query-gpu=utilization.gpu,utilization.memory --
format=csv,nounits,noheader`
# Gathering aws credential data and put it to cloudwatch
export AWS_DEFAULT_REGION=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-
zone | sed 's/[a-z]$//'`
INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
# Send values to CloudWatch
aws cloudwatch put-metric-data --metric-name Utilization --namespace $NAMESPACE --dimensions
"InstanceId=${INSTANCE_ID}" --unit 'Percent' --value ${STATS[0]}
aws cloudwatch put-metric-data --metric-name MemoryUtilization --namespace $NAMESPACE --dimensions
"InstanceId=${INSTANCE_ID}" --unit 'Percent' --value ${STATS[1]}
Monitor GPU instances
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Optimizations
# Run all commands as root
# Query GPU’s
nvidia-smi -L
# Configure the GPU settings to be persistent.
nvidia-smi -pm 1
# Disable the auto boost feature for all GPUs on the instance.
nvidia-smi --auto-boost-default=0
# Query clock speeds
nvidia-smi -q -d SUPPORTED_CLOCKS
#(P3/G3) Set GPU clock speeds to max. frequency.
nvidia-smi -ac 2505,1177
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Redirect traffic automatically
• Serve pre-generated content
• Minimize impact during spikes
• Safe scaling
Lambda@Edge checks GPU health
• Network calls on Viewer/Origin requests
• 5s/30s timeout
• Rewrite request
Pre-rendered content
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
const https = require('https');
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
// Fetch metrics from API endpoint
const jsonUrl = 'https://example.com/api/metrics.json';
https.get(jsonUrl, (res) => {
let content = '';
res.on('data', (chunk) => { content += chunk; });
res.on('end', () => {
const apiStatus = JSON.parse(content);
if (Boolean(apiStatus['config']['overloaded'])) // GPU Fleet is under high load
request.uri = apiStatus['config']['redirect']; // Rewrite request
callback(null, request);
});
});
};
Lambda@Edge code example
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Make customization the new normal
Photorealistic real-time 3D online configurators
C u s t o m e r e x a m p l e — M Y C S
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MYCS
Photorealistic
3D configurators
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MYCS
Highly customizable furniture
thanks to modularity
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MYCS
Short lead times
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MYCS
Affordable premium quality
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
3D configurators
MYCS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What can you expect?
Main challenge when building a real-time 3D online configurator
• Client-side vs. server-side renderings
• Ray tracing
• AWS infrastructure
• Lessons learned
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Photorealism Interactivity
(server-side renderings) (client-side WebGL)
vs.
3D configurators
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Client-side WebGL
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Server-side rendering
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Photorealism Interactivity
(server-side renderings) (client-side WebGL)
vs.
3D configurators
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Photorealism Interactivity
(server-side renderings) (client-side WebGL)
vs.
3D configurators
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Server-side rendering
● First image arrives within 2 seconds after
user interaction
● Progressive streaming of images
● High degree of interactivity
● Cross-device compatibility
● Scalable and affordable
Goals
● Not optimized for real-time applications
● Low interactivity
● Steeper learning curve and setup compared
to WebGL
● Expensive (GPU servers, licenses, etc.)
Downsides
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ray tracing
MYCS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ray tracing
Realistic simulation of lighting used to
create photorealistic looking images
The ray tracer is responsible for
performing the necessary computations to
cast shadows and light up objects. This
means you can create images full of
mirrors, transparent surfaces, and object
shadows.
Source: https://commons.wikimedia.org/wiki/File:Ray_trace_diagram.svg
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ray tracing
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS + GPU ray tracing
MYCS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Main challenge
Rendering speed and (affordable) scalability
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v1.0
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v1.0
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rendering streaming protocol
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v1.0
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v2.0
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v3.0
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v4.0
( c u r r e n t v e r s i o n )
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure v5.0
( i n p r o g r e s s )
HTTP/2 Push
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lessons learned
• Aim for the best possible hardware
• Don’t be afraid to step deep into rendering topics
• Always re-evaluate your infrastructure
• Keep most of your energy on the renderer
• Don’t just stick to one technology
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!
C l a u d i o B r e d f e l d t – C T O - M Y C S
C h r i s t o p h K a s s e n – S o l u t i o n s A r c h i t e c t - A W S

More Related Content

What's hot

BGP/MPLS-VPNのお勉強資料
BGP/MPLS-VPNのお勉強資料BGP/MPLS-VPNのお勉強資料
BGP/MPLS-VPNのお勉強資料
Toshiki Tsuboi
 

What's hot (20)

NVIDIA HPC ソフトウエア斜め読み
NVIDIA HPC ソフトウエア斜め読みNVIDIA HPC ソフトウエア斜め読み
NVIDIA HPC ソフトウエア斜め読み
 
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
 
UEFI時代のブートローダ
UEFI時代のブートローダUEFI時代のブートローダ
UEFI時代のブートローダ
 
そろそろレガシーな.Net開発をやめなイカ?
そろそろレガシーな.Net開発をやめなイカ?そろそろレガシーな.Net開発をやめなイカ?
そろそろレガシーな.Net開発をやめなイカ?
 
【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会
 
Kotlin/Native 「使ってみた」の一歩先へ
Kotlin/Native 「使ってみた」の一歩先へKotlin/Native 「使ってみた」の一歩先へ
Kotlin/Native 「使ってみた」の一歩先へ
 
全文検索サーバ Fess 〜 全文検索システム構築時の悩みどころ
全文検索サーバ Fess 〜 全文検索システム構築時の悩みどころ全文検索サーバ Fess 〜 全文検索システム構築時の悩みどころ
全文検索サーバ Fess 〜 全文検索システム構築時の悩みどころ
 
WiredTigerを詳しく説明
WiredTigerを詳しく説明WiredTigerを詳しく説明
WiredTigerを詳しく説明
 
BGP/MPLS-VPNのお勉強資料
BGP/MPLS-VPNのお勉強資料BGP/MPLS-VPNのお勉強資料
BGP/MPLS-VPNのお勉強資料
 
WebAssemblyのWeb以外のことぜんぶ話す
WebAssemblyのWeb以外のことぜんぶ話すWebAssemblyのWeb以外のことぜんぶ話す
WebAssemblyのWeb以外のことぜんぶ話す
 
急速に進化を続けるCNIプラグイン Antrea
急速に進化を続けるCNIプラグイン Antrea 急速に進化を続けるCNIプラグイン Antrea
急速に進化を続けるCNIプラグイン Antrea
 
インフラ刷新プロジェクト「Neco」が目指す最高のクラウドとは
インフラ刷新プロジェクト「Neco」が目指す最高のクラウドとはインフラ刷新プロジェクト「Neco」が目指す最高のクラウドとは
インフラ刷新プロジェクト「Neco」が目指す最高のクラウドとは
 
Redisの特徴と活用方法について
Redisの特徴と活用方法についてRedisの特徴と活用方法について
Redisの特徴と活用方法について
 
Introduction to Yocto Project - Let's make customized embedded linux
Introduction to Yocto Project - Let's make customized embedded linuxIntroduction to Yocto Project - Let's make customized embedded linux
Introduction to Yocto Project - Let's make customized embedded linux
 
Ansibleの最近の動向を追ってみた
Ansibleの最近の動向を追ってみたAnsibleの最近の動向を追ってみた
Ansibleの最近の動向を追ってみた
 
ベアメタルで実現するSpark&Trino on K8sなデータ基盤
ベアメタルで実現するSpark&Trino on K8sなデータ基盤ベアメタルで実現するSpark&Trino on K8sなデータ基盤
ベアメタルで実現するSpark&Trino on K8sなデータ基盤
 
Flumeを活用したAmebaにおける大規模ログ収集システム
Flumeを活用したAmebaにおける大規模ログ収集システムFlumeを活用したAmebaにおける大規模ログ収集システム
Flumeを活用したAmebaにおける大規模ログ収集システム
 
ITコミュニティと情報発信に共通する成長と貢献の要素
ITコミュニティと情報発信に共通する成長と貢献の要素ITコミュニティと情報発信に共通する成長と貢献の要素
ITコミュニティと情報発信に共通する成長と貢献の要素
 
明日からはじめられる Docker + さくらvpsを使った開発環境構築
明日からはじめられる Docker + さくらvpsを使った開発環境構築明日からはじめられる Docker + さくらvpsを使った開発環境構築
明日からはじめられる Docker + さくらvpsを使った開発環境構築
 
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
 

Similar to Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderings on AWS - ARC405 - re:Invent 2017

Similar to Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderings on AWS - ARC405 - re:Invent 2017 (20)

DAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the CloudDAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the Cloud
 
AWS Compute Evolved Week: High Performance Computing on AWS
AWS Compute Evolved Week: High Performance Computing on AWSAWS Compute Evolved Week: High Performance Computing on AWS
AWS Compute Evolved Week: High Performance Computing on AWS
 
High Performance Computing on AWS
High Performance Computing on AWSHigh Performance Computing on AWS
High Performance Computing on AWS
 
Create a Serverless Image Processing Platform
Create a Serverless Image Processing PlatformCreate a Serverless Image Processing Platform
Create a Serverless Image Processing Platform
 
The Gronk Effect: Efficiently Handling Huge Spikes in Traffic Using Predictiv...
The Gronk Effect: Efficiently Handling Huge Spikes in Traffic Using Predictiv...The Gronk Effect: Efficiently Handling Huge Spikes in Traffic Using Predictiv...
The Gronk Effect: Efficiently Handling Huge Spikes in Traffic Using Predictiv...
 
Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...
 
Born in the Cloud, Built like a Startup
Born in the Cloud, Built like a StartupBorn in the Cloud, Built like a Startup
Born in the Cloud, Built like a Startup
 
MAE301_Boom for your Buck
MAE301_Boom for your BuckMAE301_Boom for your Buck
MAE301_Boom for your Buck
 
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
 
Verizon: Modernizing Enterprise Infrastructure with AWS - WIN307 - re:Invent ...
Verizon: Modernizing Enterprise Infrastructure with AWS - WIN307 - re:Invent ...Verizon: Modernizing Enterprise Infrastructure with AWS - WIN307 - re:Invent ...
Verizon: Modernizing Enterprise Infrastructure with AWS - WIN307 - re:Invent ...
 
WIN203_With Amazon EC2 for Windows Server and Thinkbox Deadline
WIN203_With Amazon EC2 for Windows Server and Thinkbox DeadlineWIN203_With Amazon EC2 for Windows Server and Thinkbox Deadline
WIN203_With Amazon EC2 for Windows Server and Thinkbox Deadline
 
ARC205_Born in the Cloud
ARC205_Born in the CloudARC205_Born in the Cloud
ARC205_Born in the Cloud
 
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech TalksAWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
 
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
 
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Heterogenous Migration with DMS & SCT - Michael Russo
Heterogenous Migration with DMS & SCT - Michael RussoHeterogenous Migration with DMS & SCT - Michael Russo
Heterogenous Migration with DMS & SCT - Michael Russo
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
 
NEW LAUNCH! Delivering Powerful Graphics-Intensive Applications from the AWS ...
NEW LAUNCH! Delivering Powerful Graphics-Intensive Applications from the AWS ...NEW LAUNCH! Delivering Powerful Graphics-Intensive Applications from the AWS ...
NEW LAUNCH! Delivering Powerful Graphics-Intensive Applications from the AWS ...
 
Getting Started with AWS for Developers
Getting Started with AWS for DevelopersGetting Started with AWS for Developers
Getting Started with AWS for Developers
 

More from Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderings on AWS - ARC405 - re:Invent 2017

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. B u i l d i n g a P h o t o r e a l i s t i c R e a l - t i m e 3 D C o n f i g u r a t o r w i t h S e r v e r - s i d e R e n d e r i n g s o n A W S C l a u d i o B r e d f e l d t – C T O - M Y C S C h r i s t o p h K a s s e n – S o l u t i o n s A r c h i t e c t - A W S A R C 4 0 5 D e c e m b e r 1 , 2 0 1 7 AWS re:INVENT
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What can you expect? • Introduction to 3D configurators • Rendering on AWS • Integrate 3D into your web application • Customer story—mycs Our expectations • Knowledge of AWS services • 3D visualization basics
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 3D configurators A b r i e f i n t r o d u c t i o n
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Real-time configurators Cars, fashion, furniture... Benefits • Engage with customers • Visualize final product • Support buying decision Server-side rendering • Quality • Speed • Low cost
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rasterizers • Composing vectors/polygons • OpenGL/DirectX • GPU accelerated Ray tracing • Send traces through scene • Photorealistic images • GPGPU-optimized • CUDA or OpenCL 3D rendering Image View ray Shadow ray Camera Light source Scene object
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rendering on AWS
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. P3 1-8 GPUs NVIDIA Tesla V100 Volta architecture 1x GPU core 5,120 CUDA cores, 640 tensor cores 16 GB HBM2 Intel Xeon E5-2686 v4 (Broadwell) ENA adapter G3 1-4 GPUs NVIDIA Tesla M60 Maxwell architecture 2x GPU cores 4096 CUDA cores 16 GB GDDR5 Intel Xeon E5-2686 v4 (Broadwell) ENA adapter AWS GPU instances
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Elastic GPU—key features Flexible instance size and attachment • Right-size instance selection • Utilize Auto Scaling to handle requests Windows instances only OpenGL 4.2 support • No CUDA, OpenCL, and DirectX support • Ensure application runs on OpenGL rendering
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Elastic GPU—operations Elastic GPU ENI consumes additional IP Rendering max. 25 fps Use GPU Caps Viewer to view OpenGL extensions Troubleshooting Display framerate C:Program FilesAmazonEC2ElasticGPUsconfeg.conf [Application] show_fps=1
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How do I choose? Instance P3 Supports: OpenGL 4.5, DirectX 12.1 CUDA 9.0+, OpenCL 1.2+ G3 Supports: OpenGL 4.5, DirectX 12.0 CUDA 8.0+, OpenCL 1.2 Elastic GPU Supports: OpenGL 4.2 Use cases Machine learning Computational finance, genomics... 3D visualizations 3D rendering Video encoding.... Applications benefiting from some GPU
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 3D rendering in web apps
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Integrate rendering into web apps What do we need? • Rendering API • Web app/microservices • Renderer • 3D model and model configuration • Caching Other requirements • (Near) real-time rendering • High-quality rendered images
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rendering Rasterizer • Unity • Amazon Lumberyard Ray tracer • Nvidia Iray, 3ds max… • Cycles (Blender) Integrate engine • Write image to file • Grab framebuffer • Utilize native integration
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. import bpy, _cycles print(_cycles.available_devices()) bpy.context.scene.render.engine = 'CYCLES' bpy.context.scene.cycles.device = 'GPU' bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA' # Larger tile sizes optimal for GPU processing bpy.context.scene.render.tile_x = 256 bpy.context.scene.render.tile_y = 256 Ray tracing with Blender Run Blender from the CLI blender -b ~/blender/model.blend -o ~/blender/tmp/ -P ~/blender/gpu_settings.py -f 1
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ray tracer on GPU instances Auto-scaled services and rendering API Network Load Balancer (NLB) • Stream images with http/2 push • TCP level load-balancer Serve pre-rendered assets via CDN Caching • Utilize CloudFront caching • Rendering API • Custom caching for http/2
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rasterizer with Elastic GPU Auto Scaling • Only a single fleet of instances • Instances right-sized • Elastic GPU attached Rasterizer engine, e.g. Unity Caching • Pre-rendered assets • Request contains 3D model configuration
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Operations Monitor GPU utilization • GPU instances use nvidia-smi to query data • Elastic GPU memory usage Custom CloudWatch metrics from rendering API Auto Scaling • Scale GPU fleet based on custom metrics • Scale up aggressively • Scale down slowly
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon CloudWatch metrics
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. #!/bin/bash NAMESPACE='GPU/Metrics' # Metrics namespace # Fetch GPU metrics IFS=', ' read -r -a STATS <<< `nvidia-smi --query-gpu=utilization.gpu,utilization.memory -- format=csv,nounits,noheader` # Gathering aws credential data and put it to cloudwatch export AWS_DEFAULT_REGION=`curl -s http://169.254.169.254/latest/meta-data/placement/availability- zone | sed 's/[a-z]$//'` INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` # Send values to CloudWatch aws cloudwatch put-metric-data --metric-name Utilization --namespace $NAMESPACE --dimensions "InstanceId=${INSTANCE_ID}" --unit 'Percent' --value ${STATS[0]} aws cloudwatch put-metric-data --metric-name MemoryUtilization --namespace $NAMESPACE --dimensions "InstanceId=${INSTANCE_ID}" --unit 'Percent' --value ${STATS[1]} Monitor GPU instances
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Optimizations # Run all commands as root # Query GPU’s nvidia-smi -L # Configure the GPU settings to be persistent. nvidia-smi -pm 1 # Disable the auto boost feature for all GPUs on the instance. nvidia-smi --auto-boost-default=0 # Query clock speeds nvidia-smi -q -d SUPPORTED_CLOCKS #(P3/G3) Set GPU clock speeds to max. frequency. nvidia-smi -ac 2505,1177
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Redirect traffic automatically • Serve pre-generated content • Minimize impact during spikes • Safe scaling Lambda@Edge checks GPU health • Network calls on Viewer/Origin requests • 5s/30s timeout • Rewrite request Pre-rendered content
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. const https = require('https'); exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; // Fetch metrics from API endpoint const jsonUrl = 'https://example.com/api/metrics.json'; https.get(jsonUrl, (res) => { let content = ''; res.on('data', (chunk) => { content += chunk; }); res.on('end', () => { const apiStatus = JSON.parse(content); if (Boolean(apiStatus['config']['overloaded'])) // GPU Fleet is under high load request.uri = apiStatus['config']['redirect']; // Rewrite request callback(null, request); }); }); }; Lambda@Edge code example
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Make customization the new normal Photorealistic real-time 3D online configurators C u s t o m e r e x a m p l e — M Y C S
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MYCS Photorealistic 3D configurators
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MYCS Highly customizable furniture thanks to modularity
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MYCS Short lead times
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MYCS Affordable premium quality
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 3D configurators MYCS
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What can you expect? Main challenge when building a real-time 3D online configurator • Client-side vs. server-side renderings • Ray tracing • AWS infrastructure • Lessons learned
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Photorealism Interactivity (server-side renderings) (client-side WebGL) vs. 3D configurators
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Client-side WebGL
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Server-side rendering
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Photorealism Interactivity (server-side renderings) (client-side WebGL) vs. 3D configurators
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Photorealism Interactivity (server-side renderings) (client-side WebGL) vs. 3D configurators
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Server-side rendering ● First image arrives within 2 seconds after user interaction ● Progressive streaming of images ● High degree of interactivity ● Cross-device compatibility ● Scalable and affordable Goals ● Not optimized for real-time applications ● Low interactivity ● Steeper learning curve and setup compared to WebGL ● Expensive (GPU servers, licenses, etc.) Downsides
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ray tracing MYCS
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ray tracing Realistic simulation of lighting used to create photorealistic looking images The ray tracer is responsible for performing the necessary computations to cast shadows and light up objects. This means you can create images full of mirrors, transparent surfaces, and object shadows. Source: https://commons.wikimedia.org/wiki/File:Ray_trace_diagram.svg
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ray tracing
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS + GPU ray tracing MYCS
  • 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Main challenge Rendering speed and (affordable) scalability
  • 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v1.0
  • 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v1.0
  • 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rendering streaming protocol
  • 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v1.0
  • 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v2.0
  • 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v3.0
  • 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v4.0 ( c u r r e n t v e r s i o n )
  • 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Infrastructure v5.0 ( i n p r o g r e s s ) HTTP/2 Push
  • 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lessons learned • Aim for the best possible hardware • Don’t be afraid to step deep into rendering topics • Always re-evaluate your infrastructure • Keep most of your energy on the renderer • Don’t just stick to one technology
  • 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you! C l a u d i o B r e d f e l d t – C T O - M Y C S C h r i s t o p h K a s s e n – S o l u t i o n s A r c h i t e c t - A W S