Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Microservices with Laravel Lumen
Search
Mathias Hansen
November 18, 2015
Technology
1
2.7k
Microservices with Laravel Lumen
PHP World 2015
Mathias Hansen
November 18, 2015
Tweet
Share
More Decks by Mathias Hansen
See All by Mathias Hansen
Launching & Scaling a Side Project
minicodemonkey
3
1.1k
Other Decks in Technology
See All in Technology
エンジニアの育成を支える爆速フィードバック文化
sansantech
PRO
3
1.1k
(機械学習システムでも) SLO から始める信頼性構築 - ゆる SRE#9 2025/02/21
daigo0927
0
150
明日からできる!技術的負債の返済を加速するための実践ガイド~『ホットペッパービューティー』の事例をもとに~
recruitengineers
PRO
3
410
飲食店予約台帳を支えるインタラクティブ UI 設計と実装
siropaca
7
1.8k
プロダクトエンジニア構想を立ち上げ、プロダクト志向な組織への成長を続けている話 / grow into a product-oriented organization
hiro_torii
1
220
データの品質が低いと何が困るのか
kzykmyzw
6
1.1k
「海外登壇」という 選択肢を与えるために 〜Gophers EX
logica0419
0
710
RSNA2024振り返り
nanachi
0
580
Larkご案内資料
customercloud
PRO
0
650
Culture Deck
optfit
0
420
開発スピードは上がっている…品質はどうする? スピードと品質を両立させるためのプロダクト開発の進め方とは #DevSumi #DevSumiB / Agile And Quality
nihonbuson
2
3k
ユーザーストーリーマッピングから始めるアジャイルチームと並走するQA / Starting QA with User Story Mapping
katawara
0
210
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
For a Future-Friendly Web
brad_frost
176
9.5k
Mobile First: as difficult as doing things right
swwweet
223
9.3k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
Adopting Sorbet at Scale
ufuk
74
9.2k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Optimizing for Happiness
mojombo
376
70k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Transcript
Microservices with Laravel Lumen by @MathiasHansen php[world] 2015
Who I Am » I speak English, Danish, and PHP
» Have done so for most of my life » Self-proclaimed Laravel evangelist » Started Capital Laravel Group in 2013
What I Do
What We're Going to Do » Microservices, defined » How
we're using Microservices at VB » Benefits and drawbacks » Microservices with Lumen » Questions
What's a Microservice?
A Microservice should be Designed around a single business capability
None
None
We have... » A big monolithic app » A growing
team » Concerns mostly separated » Let's go one step further
! Microservices ! to the rescue
None
Implementing a Microservice
None
Define a contract » REST? » Protobuf? » SOAP? (please
don't do this)
Plan ahead » How big should your service be? »
How many services should you have? » Share common code across services » use composer
Use an API Manager » api.videoblocks.com/search ➡ searchservice.internal » api.videoblocks.com/abtest
➡ abtestservice.internal » Authentication » Rate limiting » Usage tracking
A Microservice Hybrid or go all the way? » Monolithic
app + Micro services » Static Frontend + Micro services » PHP Gateway + Micro services
Immediate benefits
Teamwork, simplified » Can use any programming language or data
store under the hood » A small team can own the entire process from dev to deployments » Great for onboarding
Deployments, simplified » Deploy a "piece" of the app instead
of full monolith » Independent deployment schedule
Testing, simplified » Unit test » Internal functionality » Integration
test » External interface » Load test » Ability to test each service individually
Scaling, simplified Allocate extra resources to the service that needs
it » Isolate hot/cold zones
Hold your horses
None
Things to Consider
Complexity » Increases complexity of your app » Network overhead
» More planning necessary
How big is your team?
Automation is key Development ➡ testing ➡ deployment
None
What is Lumen?
A microframework » But not necessarily in the traditional sense
» Based on Laravel components » Follows Laravel versioning » Laravel Lumen 5.1 ➡ Laravel 5.1
It still packs a punch » Blade (templating) » Caching
» Commands » Controllers » Eloquent ORM » Dependency Injection » Queueing » Testing » And more...
If you're familiar with Laravel, you already know how to
use Lumen.
Lumen is fast
No, seriously! It's kind of the point
Faster routing + Opt-in rather than opt-out = Smaller footprint
out of the box
Routing » Uses nikic/FastRoute for routing » You don't need
a fancy C extension to make routing fast
Opt-in » Core features has to be explictly enabled: »
dotenv, facades, Eloquent ORM, etc. » Service Providers » Middlewares » CSRF protection, cookie encryption, session handling etc.
What is Lumen not? » Does not support Laravel 5
packages » Very minimal config system out of the box » Uses environment variables » Can use full config system if you want » Router has fewer features
Use cases
Use it for Microservices duh!
Tiny websites Status page, landing page Example: status.geocod.io
High-traffic component of your website Example: Envoyer cron job heartbeat
The competition
Conclusion » Define your contract first » Design your microservice
around a single business capability » Plan ahead » Define testing & deployment strategy » Use Lumen for microservices or other small standalone apps
Additional resources Building Microservices by Sam Newman Martin Fowler's Articles
http://martinfowler.com/articles/microservices.html Taylor Otwell's Lumen Laracasts https://laracasts.com/lessons/introducing-lumen
Questions? Talk to me @MathiasHansen
[email protected]