This commit is contained in:
Correl Roush 2021-03-23 01:53:40 -04:00
parent d9cd42fbcc
commit dbfff51ae3

View file

@ -3,8 +3,51 @@
A [[file:20210310182044-software_architecture.org][Software Architecture]] consisting of multiple independant pieces of software
coordinating via message passing.
* A "Monolithic" Web application as a distributed system
A monolith presents itself as a single black box with no external dependencies or race conditions to contend with. But, is it?
- There's probably some sort of database to store state.
- If it's a web application, its clients are distributed!
#+begin_src plantuml :file distributed-web-application.svg :exports results
actor Browser
participant WebApp
database Database
Browser -> WebApp : Request Page
WebApp -> Database : Load Data
Database -> WebApp : Return Data
WebApp -> Browser : Render Page
...
Browser -> WebApp : Save Form
WebApp -> Database : Write Data
Database -> WebApp : Data Stored
WebApp -> Browser : Done!
#+end_src
#+RESULTS:
[[file:distributed-web-application.svg]]
- Myths
+ The database is local, therefore the connection is guaranteed to be fast and
stable.
+ Data is isolated to the user accessing it, there's no possibility for race
conditions / having to merge data.
+ The behavior of one user won't affect the experience of another.
- Any one of those lines of communication could fail for some reason
+ Bad request :: Something the user sent could cause an error
+ Bad state :: A service could be in a bad state and fail to react as
expected. The web server or database may be overloaded. Invalid data could
be persisted, breaking further requests.
+ Network issues :: Even on the same host, the other service could be down or
inaccessible.
- Any of those activities could occur /concurrently/
+ What happens when two different users try to save changes to the same data?
Or the same user, from two different clients or browser tabs?
* [[file:20210323010700-process_isolation.org][Process Isolation]]
- Monolith vs. Services
* [[file:20210323012431-concurrent_and_parallel_programming.org][Concurrent and Parallel Programming]]
#+begin_quote