2. Twiga Foods Limited - Brief intro
“At Twiga, we help bridge the gap between farmers and vendors to fair,
trusted, modern markets. We help farmers get fresh produce to the
market efficiently and profitably”
3. Microservices - What now ?
$ 987
“Small autonomous services that work together,
modeled around a business domain.”
- Sam Newman
4. Microservices - Isn't just SOA?
$ 987
● SOA focused on the use of an ESB to allow services to communicate with one
another
● Martin Fowler's definition of microservices…
"… developing a single application as a suite of small services, each
running own process and communicating using light-weight
mechanisms (HTTP API)"
● Matt Bennett (OneFineStay - Nameko birthplace)…
"Maintainability at scale"
"Independently Deployable"
5. Flipside - Monoliths
$ 987
● A monolith is an application where everything is
bundled as one, has a single code base with multiple
modules and is designed to be self-contained.
● Modules are interconnected and interdependent in a
very tightly coupled architecture.
7. Monoliths - The Challenges
$ 987
● Less freedom, flexibility & decreased velocity.
● Limited to vertical scaling
● Harder to maintain our codebase
● Single point of failure
● Increased risk per commit
● Increased risk of system failure
8. Microservices - The Benefits
$ 987
● Increased freedom, flexibility & velocity.
● Suited for horizontal scaling
● Easier to maintain our codebase
● Reduced risk per commit
● Faster failure detection - devolved monitoring/ error reporting
9. Design Patterns
● Decomposition Patterns
■ Decompose by Business Capability
■ Decompose by Subdomain
● Integration Patterns
■ API Gateway Pattern
■ Aggregator Pattern
● Database Patterns
■ Single Database per service
■ Shared Database per service
12. Case Scenario
● An E-Commerce platform implemented with Nameko
● Domains
■ Authentication
■ Notification
■ Sales
■ Products
13. Nameko - What’s that?
Nameko
[ nah - meh - koh ]
A microservice framework for Python.
14. Nameko - Key Concepts
● Entrypoints - to your services (HTTP, AMQP [RPC, Pub/Sub]...)
● Dependencies - how your services will interact with external things
(DB, MQ, Redis ...)
● Dependency Providers
● Dependency Injection
15. Nameko - The Benefits?
● An extensible framework compatible with almost any protocol,
transport or database and helps one focus on business logic by
managing connections, transports, and concurrency for you.
● Provides easy concurrency model by yielding workers as they wait
for I/O
● RPC out of the box
16. Nameko - The Architecture
Auth Service
Product Service
Sales Service
Notification
Service
Auth DB
Auth Service
Notificati
on DB
Sales
DB
Product
DB
Pub/Sub
Pub/Sub
RPC
API Gateway
19. GraphQL Concepts
“is a query language for your API, and a server-side runtime for executing queries
by using a type system you define for your data. GraphQL isn’t tied to any specific
database or storage engine and is instead backed by your existing code and
data.”
- graphql.org
21. Docker Concepts
● Provides a way to run applications securely & isolated in a container,
packaged with all its libraries and dependencies, ensuring that your
application works seamlessly in any environment.
● Offers abstraction by which an application can quickly move or be set up
with minimal interaction and tinkering.
22. Kubernetes Concepts
“Kubernetes (K8s) is an open-source system for automating deployment, scaling,
and management of containerized applications”
- kubernetes.io
23. Kubernetes Benefits
● Used to orchestrate, deploy and manage container clusters, which are a
group of containers.
● Handles load balancing
● Self heals
● Scales horizontally with ease
25. Microservices - When not to
● Starting out
● Don’t have a large team
● Microservices can be distributed monoliths
● Complex service to service relationships
● Too small to break
● Extremely dependant modules
● There is beauty in simplicity
26. Microservices - Reality Check!
$ 987
● Migrating to microservices was a challenge. It took 6 PAINFUL months
before we could report any successes to management. Steep learning
curves meant a lot of initial mistakes and time spent understanding this
paradigm shift.
27. Where To Get Help
Google StackOverflowNameko Docs
https://stackoverflow.com/que
stions/tagged/namekohttps://www.google.com https://nameko.io