Upload
kazki-matsumoto
View
302
Download
1
Embed Size (px)
Citation preview
From PHP Monolith to
Polyglot Microservices
Kazki Matz @ CareerLink Vietnam
About me
• Kazuki MATSUMOTO (Kazki Matz) • Rubyist (Since 2009) • Been living in Vietnam (Since 2012)
• CTO at CareerLink Vietnam (Since 2012)
www.careerlink.vn
Our architecture (~ 2015)
• PHP Monolith built with Symfony2
Symfony2 Monolith (mod_php)
LB (Nginx)
MySQL
mongoDB
ElasXcsearch
Microservices Architecture
Building applicaXon as a suite of small services • Each service has it’s own codebase • Each service runs under dedicated process • Each service can be wriZen in different languages
• Each service has it’s own datastore • Each service has it’s own deployment strategy
Our architecture (2015 ~)
ElasXcsearch
LB (Nginx)
mongo MySQL
Symfony2 Monolith
(mod_php + CLI)
mongo MySQL
API endpoint (Rails)
MySQL
Messaging (Rails)
ElasXcsearch
RecommendaXon Engine
Document censorship
Document Converter
RabbitMQ Broker
ElasXcsearch
Site StaXsXcs Dashboard
• Inter-‐process communicaXon overhead – SerializaXon, Network RTT
• New middlewares – Load balancing / API discovery
• More management costs – Monitoring & Error NoXficaXons
– Deployment Infrastructure – Performance Profiling
Cost of Microservices
• Inter-‐process communicaXon overhead – SerializaXon, Network RTT
• New middlewares – Load balancing / API discovery / Profiling
• More management costs – Monitoring & Error NoXficaXons
– Deployment Infrastructure – Performance Profiling
Cost of Microservices
• Inter-‐process communicaXon overhead – SerializaXon, Network RTT
• New middlewares – Load balancing / API discovery
• More management costs – Monitoring & Error NoXficaXons
– Deployment Infrastructure – Performance Profiling
Cost of Microservices
New middlewares
• Load balancing • API discovery / rouXng service • RPC request profiling
RabbitMQ RPC: Pros
• No need of load balancing • No need of API discovery service • Synchronous RPC / Asynchronous Messaging
• Nice built-‐in web UI
RabbitMQ RPC: Cons
• Not scalable • No request logging/profiling
• Inter-‐process communicaXon overhead – SerializaXon, Network RTT
• New middlewares – Load balancing / API discovery
• More management costs – Monitoring & Error NoXficaXons
– Deployment Infrastructure – Performance Profiling
Cost of Microservices
Error NoXficaXons
Deployment
Cost of Microservices
• Inter-‐process communicaXon overhead – SerializaXon, Network roundtrip
• New middlewares – API gateway
• More management costs – Monitoring & Error NoXficaXons
– Deployment Infrastructure – Performance Profiling
fluentd: The Log Collector for Rubyists
ElasXcsearch
Logging each RPC request…
ElasXcsearch
LB (Nginx)
mongo MySQL
Symfony2 Monolith
(mod_php + CLI)
MySQL
mongo MySQL
API endpoint (Rails)
Messaging (Rails)
ElasXcsearch
RecommendaXon Engine
Document censorship
Document Converter
Site StaXsXcs Dashboard
fluent-‐logger-‐php
fluent-‐logger
fluent-‐logger fluent-‐logger
fluent-‐logger
fluent-‐logger
fluent-‐logger
fluentd
ElasXcsearch
fluent-‐plugin-‐kibana
Kibana
DEMO
Summary
• Microservices architecture is a good way to…
– Keep moXvated on coding
– Catch up latest technologies
Jobs on careerlink.vn
QuesXons?