2017-08-04#Architecture” and “Design”. In a nutshell, architecture is a type of design where the focus is quality attributes and wide(er) scope whereas design focuses on functional requirements and more localized concerns.
Randy Shoup - Techniques for dealing with shared data, joins, and transactions in a microservices architecture#https://www.infoq.com/presentations/microservices-data-centric
Software combines #Organizes
- Small Teams directly defined within a particular function of the business.
- Teams need other teams.
Processes - Test Driven Development#
- Testing increases velocity
- Tests make better code
- Provides courage to try new thing, knowing you can refrator something and know it will work or not.
- Tests allow fast failures
We do not have time to do it right? - Do you have time to do it more than once?
- The more time constraints the more it is better to build it right (80/20 rule)
- Better to build one thing right than two things half-right.
- Release smaller sprints.
- Allows rapid experiments
- You build it, you Run it.
- End-to-end ownership of what you write - Full lifecycle of software.
- No separate QA team
- No separate Deployment team
Evolution to microservices#
- ebay 5th generation
- C++ 3.4 million lines of code
- Java - Several different Java Apps
- Polyglot of microservices.
- Mono perl and c++ OBIDOUS
- Java Scala
Microservices may not be the right for startups. Monos are ok.
- Scope is single purpose
- Moduler and independenrt
- SOA done properly (Bounded Context)
- No sneaking in to look at the other guys data.
- Same team that writes the micorservice owns the data store OR - use a external data store
- Still ISOLATED
- Only external access to data store is via public interface
Event-triggered should be a first-class object#
- A thing happend - Something I cared about
- Asynchronous Operation - No care if someone is listening.
- State changes or events must be used.
- Why - Represents how the world works
Must be within an interface within microservices
- interface is for any data into or out of a microservice
- Stich Fix is still a mono data base with 175 tables
- Single point of failure.
Solution is decoupling data how to do it #
- Write a service interface to isolate data access for the table.
- Rinse and repaet
- Simple discussion but a lot of code changes and joins etc.
Bounded context mentioned many times.
- shared data
- Joins work well in mono-data
One service OWNS the data (Customer)
- Every other service is a RO non-authoritative service
Approach one just look it up? - Every other service looks it up
If too expensive to do ...Eventing from Customer service
- colors, US States, Shoe Sizes zip codes ....
Joins in microservices #
- Approach one - Joins in application
- make two calls to different services.
- Works well for one-to-many just as a Web page does.
- Maintain a cache of a join
- Item feedback example many-to-many
- Listens to items service and feedback service to make join ....
- Materializing a view in realtime
- NoSql does this
Transactions #Easy in relation db. ACID etc.
- SAGA Pattern -
- Commit - Workflow that updates different data stores.
- Rollback - reverse workflow
- Serverless - Functions as a Service is a great way to do this.
Big believer Lambda Google Cloud functions Azure Functions - triggered by events and produces an event
Stich Fix is hiring - 50% are remote
Events that do not arrive or like SLP exactly once deliver out of order more than once
Evens should use - At least once deliver
- More than once Mutiple times - Item impotent
- Out of order - Do you care - Consumer must maintain state
At most once - think of UDP