record

View the Project on GitHub lavendarlatte/record

Scalability

Vertical scaling

More RAM, SSD, CPU - has physical limit. No redundancy.

Horizontal scaling

Multiple cheaper servers. Public IP address should point to load balancer and use private IP addresses for servers. We cannot load balance in DNS server level because clients usually cache DNS record (TTL: time to live), and subsequent requests will go to the same server. LB can save random number to server IP mapping instead and set random number to cookie saved in user browser to maintain session for a certain amount of time.

Now sessions need to be stored in a centralized data store which is accessible to all servers. Then, there is no redundancy, and uptime is bad if this file server breaks.

Database replication

Redundancy in one server can be achieved by RAID.

Still, server can lose power so we need replication.

Database partitioning

Relational vs Non-relational DB

MySQL is more common, but if your application requires super-low latency, your data are unstructured, you need to store a massive amount of data, and you only need to serialize/deserialize data, consider NoSQL.

Caching