Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP w Google Cloud @ PHPCon Poland 2022

PHP w Google Cloud @ PHPCon Poland 2022

Google Cloud oferuje blisko 200 różnych usług chmurowych - w tym maszyny wirtualne oraz rozwiązania serverless. Które z nich sprawdzą się najlepiej dla aplikacji napisanych w PHP? Podczas prezentacji omówię różnice między Compute Engine, App Engine, Kubernetes Engine, Cloud Run oraz Cloud Functions. Podpowiem też jakie usługi towarzyszące wybrać dla baz danych, przestrzeni dyskowej czy kolejek.

Sebastian Grodzicki

October 29, 2022
Tweet

More Decks by Sebastian Grodzicki

Other Decks in Technology

Transcript

  1. What is Cloud Functions? • A serverless environment to build

    and connect cloud services • Event driven - connect Cloud services 
 - via: Cloud Pub/Sub, Cloud Storage, HTTP requests & more • Serverless 
 - Fully managed execution environment 
 - Pay only for what you use 
 - Autoscales with usage
  2. Good fi t? • Serverless • Using Pub/Sub and/or Cloud

    Storage • Don't want to think about runtime env • Data transformations (ETL) • HTTP glue
  3. Constraints? • Function level granularity • Must interact via events

    • Speci fi c language runtimes (PHP 7.4 & 8.1)
  4. What is App Engine? • Managed app platform (with PHP

    5/7/8 support) • No servers to manage, scale up fast, scale down to zero • No patches/updates • Versioning • Tra ffi c splitting • "Serverless" before it was cool ;)
  5. Constraints? • Speci fi c language runtimes (standard environment) 


    
 - PHP 5.5 (1st gen) 
 - PHP 7.2 
 - PHP 7.3 
 - PHP 7.4 
 - PHP 8.1 • HTTP(S) only
  6. What is Cloud Run? • Container image with code listening

    on $PORT for HTTP • SSL termination • HTTP requests to running containers • 1-1000 concurrent requests • Autoscaling from zero to 1000s of instances • Pay only for actual CPU & memory used @ 100ms granularity
  7. Good fi t? • Stateless • HTTP request-response workloads •

    Scale: way up, down to zero, bursty • Speci fi c runtime requirements (language, dependencies, etc.)
  8. Constraints? • Must use containers • Decide on build process

    (Cloud Build, etc.) • Stateless: no persisted local state
  9. • Hosted and managed Kubernetes • Manages the cluster 


    
 - compute nodes 
 - software updates 
 - cluster autoscaling What is Kubernetes Engine?
  10. • Run app in multiple environments (multi-cloud, hybrid, dev/ test/prod)

    • Take full advantage of containers • Have good team communication between dev, ops, security, etc. • Have or want CI/CD pipeline • Network protocols beyond HTTP(S) Good fi t?
  11. • Insulate from infrastructure • Enables high utilization == cost

    savings • Abstraction sweet spot for many • Choose tools for logging, monitoring, etc. Why Kubernetes?
  12. • Managed cluster 
 
 - Focus on your application

    
 - Quick start 
 - Automatic updates Why Kubernetes Engine?
  13. • Virtual machines and networking • Per VM max: •

    224 vCPUs, 1,792 GB of RAM, 64 TB of disk, 8 GPUs, TPUs 
 - Independently con fi gurable, including disk! • Specialized machine types: 
 - up to 416 vCPU and 12 TB RAM 
 - Shared core small machines What is Compute Engine?
  14. • Virtual machines and networking • Start quickly, ~20 seconds

    to user code running • Pre-built images, or create your own 
 
 - Debian, CentOS, CoreOS, Ubuntu, RHEL, SUSE 
 - Windows Server Datacenter What is Compute Engine?
  15. • Persistent Disk • Network based • Con fi gure

    size (to 64 TB) • HDD or SSD • Independent of VM • Global Snapshots • Multi-VM RO mount • Local SSD • Lowest latency • 375 GB per disk (up to 8) • Tied to VM lifecycle Disk
  16. • Run Docker containers directly on container-optimized OS • Managed

    Instance Groups • template/image based • autoscaling • regional groups (multi-zone) • rolling updates and canaries • Load Balancer More than just VMs
  17. • Existing systems (lift and shift) • 1:1 container:VM mapping

    • Speci fi c OS/kernel required • License requirements • Running databases • Network protocols beyond HTTP(S) Good fi t?
  18. • Scaling speed fl oor 
 ~20s per VM, 1000s

    in ~60s • Decide how to handle software updates Constraints?
  19. Compute platforms Compute Engine Kubernetes Engine Cloud Run App Engine

    Cloud Functions event driven web apps events/web + containers containerized apps existing systems your code your containers { {
  20. Abstraction Compute Engine Kubernetes Engine Cloud Run App Engine Cloud

    Functions Events, function de nitions Code, HTTP Requests Container Runtime Contract, Any language Applications, not computers Your software/operating system Abstraction
  21. Control Requirements Compute Engine Kubernetes Engine Cloud Run App Engine

    Cloud Functions URL routing, tra c splitting Support any language, run in containers GPUs, TPUs, Hybrid, beyond HTTP(S) GPUs, TPUs, speci c kernel, Windows
  22. Billing model Compute Engine Kubernetes Engine Cloud Run App Engine

    Cloud Functions Usage Usage / Resources Resources Resources Usage
  23. Teams Compute Engine Kubernetes Engine Cloud Run App Engine Cloud

    Functions Team is mostly dev focused Team is mostly dev focused Team is mostly dev focused Owns build tool and deployment decisions Dev, Ops, Security work together Org is open to app architecture updates Adaptable to various team structures and tool preferences
  24. Cloud 
 Pub/Sub Cloud 
 Storage Cloud 
 Tasks Cloud

    
 Scheduler Cloud 
 Datastore Cloud 
 SQL Cloud 
 Spanner Cloud 
 Bigtable BigQuery Cloud 
 Functions App 
 Engine Cloud 
 Run Kubernetes 
 Engine Compute 
 Engine Translation 
 API Natural 
 Language API Speech 
 API Vision 
 API
  25. Move up or down abstraction levels Compute Engine Kubernetes Engine

    Cloud Run App Engine Cloud Functions Abstraction Control
  26. Compute platforms Compute Engine Kubernetes Engine Cloud Run App Engine

    Cloud Functions event driven web apps events/web + containers containerized apps existing systems your code your containers { {