System components should be horizontally scalable where possible.
It is cheaper to scale services by adding inexpensive resources like commodity servers or database nodes rather than buying larger and larger pieces of hardware which, at a given point, are unable to scale further. By embracing horizontal scalability early and designing our systems to work in this manner, we eliminate the cost of changing at a later date.
- Conversational state cannot be stored in-memory of a service instance but rather must be persisted to the client or a shared datastore.
- Provided they meet your needs, prefer “serverless” persistence options from your cloud provider, since these will typically handle the scaling-out of your application with no extra effort. e.g. Google Cloud Datastore rather than Google Cloud SQL.
- It is not always practical to scale horizontally. For example, increased performance for traditional relational databases is often achieved through better hardware or higher specifications.