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

理解して導入するWebフレームワーク ~解決すべき課題に着目する~ / Understandi...

shiro seike
September 23, 2023

理解して導入するWebフレームワーク ~解決すべき課題に着目する~ / Understanding and implementing web frameworks ~focusing on the problems to be solved~

ServerlessDays Tokyo 2023
https://tokyo.serverlessdays.io/

shiro seike

September 23, 2023
Tweet

More Decks by shiro seike

Other Decks in Programming

Transcript

  1. @seike 46 0 - - @seike 46 0 - AWS

    Community Builder Serverless - Fusic - / - / - - ServerlessDays Tokyo 2 022 Virtual - - ServerlessDays Fukuoka 2 019 Co-Chairs - ServerlessDays Tokyo 2 019 , 2 022 , 2023 2
  2. AWS Lambda Lambda 
 Lambda 
 VPC ⾒ Lambda VPC

    VPC Lambda 
 Lambda SecretManager 
 AWS CloudWatch Logs CloudWatch Metrics Lambda 5
  3. Laravel PHP Web AWS ⾒ S 3 DynamoDB Eloquent ORM

    Laravel Laravel API Passport Sanctum API API Laravel API JSON Laravel 7
  4. Bref Bref PHP OSS AWS Lambda PHP AWS Lambda PHP

    PHP 
 PHP Bref PHP PHP AWS Lambda Developer Community Laravel Symfony PHP CLI 9
  5. 
 
 Developer Community AWS Lambda PHP PHP 
 PHPer

    
 Bref Serverless Framework 10 service: app-php-serverless provider: name: aws region: ap-northeast- 1 plugins: - ./vendor/bref/bref functions: api: handler: index.php description: '' runtime: php- 8 2 -fpm timeout: 28 events: - httpApi: '*' # Exclude files from deployment package: patterns: - '!node_modules/**' - '!tests/**' $ composer require bref/bref $ vendor/bin/bref init $ serverless deploy
  6. 11 Bref AWS Lambda API Gateway 
 
 Bref API

    Gateway AWS Lambda Bref Laravel Bridge Laravel Bref Lambda
  7. Laravel Bref 12 Laravel Bref PHP 
 AWS Lambda PHP

    AWS Lambda AWS Lambda Laravel PHPer
  8. AWS Lambda 14 Lambda 
 Lambda 
 VPC ⾒ Lambda

    VPC VPC Lambda 
 Lambda SecretManager 
 AWS CloudWatch Logs CloudWatch Metrics Lambda
  9. Lambda Amazon Web Services Operating Lambda: Part 3 -Lambda -

    - - - - - Laravel - Laravel 15 URL:https://aws.amazon.com/jp/blogs/news/compute-operating-lambda-anti-patterns-in-event-driven-architectures-part- 3 / Operating Lambda: Part 3
  10. PHP Ruby AWS AWS Lambda Web Web - PHP Laravel

    CakePHP - Ruby Ruby on Rails 19
  11. Python 
 API EC 2 API API Gateway -> Lambda

    -> S 3 Json EC 2 cron 20 Python Python -> Go
  12. AWS Dev Day 2 022 AWS Dev Day 2 02

    2 Amazon S 3 Select で バ https://speakerdeck.com/seike 460 /serverless-high-load-site-realized-with-amazon-s 3 -select 26
  13. AWS Lambda x Bref x Laravel 27 
 - AWS

    Lambda - AWS S 3 Select - S 3 JSON SQL 
 PHP AWS Lambda Laravel
  14. deploy PHP 36 Deploying bref-natural to stage dev (ap-northeast-1) ✔

    Service deployed to stack bref-natural-dev (30s) endpoint: ANY - https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com functions: api: bref-natural-dev-api (260 kB) Want a better experience than the AWS console? Try out https://dashboard.bref.sh 30 260kB
  15. deploy Laravel 37 Deploying bref-laravel to stage dev (ap-northeast-1) ✔

    Service deployed to stack bref-laravel-dev (52s) endpoint: ANY - https://yyyyyyyyyy.execute-api.ap-northeast-1.amazonaws.com functions: web: bref-laravel-dev-web (32 MB) artisan: bref-laravel-dev-artisan (32 MB) Want a better experience than the AWS console? Try out https://dashboard.bref.sh 30 -> 52 260kB -> 3 2 M
  16. [#/sec] PHP 38 $ ab -n 20000 -c 10 https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/

    ~ Requests per second: 303.30 [#/sec] (mean) Requests per second: 349.55 [#/sec] (mean) Requests per second: 351.93 [#/sec] (mean) ~ EC 2 Apache Bench 351 . 93 [#/sec] 3
  17. [#/sec] Laravel 39 $ ab -n 20000 -c 10 https://yyyyyyyyyy.execute-api.ap-northeast-1.amazonaws.com/

    ~ Requests per second: 240.62 [#/sec] (mean) Requests per second: 244.52 [#/sec] (mean) Requests per second: 262.52 [#/sec] (mean) ~ EC 2 Apache Bench 351 . 93 [#/sec] -> 262 . 52 [#/sec] 3
  18. 40

  19. Role APIGateway ⾒ 43 functions: web: handler: public/index.php runtime: php-

    82 -fpm timeout: 28 events: - httpApi: '*' admin-web: handler: public/index.php runtime: php- 82 -fpm timeout: 28 role: api-admin-role events: - httpApi: method: '*' path: /admin $ serverless deploy function --function admin-web Deploying function admin-web to stage dev (ap-northeast- 1 ) ✔ Function code deployed ( 42 s) Function configuration did not change, and the update was skipped. If you made changes to the service configuration and expected them to be deployed, it most likely means that they can only be applied with a full service deployment. ( 42 s)
  20. 04

  21. AWS Lambda x Bref x Laravel 47 Web 
 AWS

    Lambda PHP ⾒ 0 Laravel Laravel Laravel AWS ⾒
  22. 49