FTP is a standard network protocol used for transferring files between a client and a server.
- Upload files to a server
- Download files from a server
- Manage files remotely
- Data is transferred in plain text
- Usernames and passwords are not encrypted
- Not considered secure for modern applications
SFTP is a secure file transfer protocol that runs over SSH (Secure Shell).
- Encrypted communication
- Secure authentication
- Safe file uploads and downloads
- Uploading website files to production servers
- Secure data exchange between organizations
- Managing remote servers
| FTP | SFTP |
|---|---|
| Not encrypted | Encrypted |
| Less secure | Highly secure |
| Uses Port 21 | Uses Port 22 (SSH) |
| Legacy protocol | Modern preferred protocol |
A VPS is a virtual machine running on a physical server.
- Amazon Web Services (AWS)
- Microsoft Azure
- Google Cloud Platform (GCP)
- DigitalOcean
- Linode
- Dedicated resources
- Better performance than shared hosting
- More control over the environment
- Can host websites, APIs, databases, and applications
As the number of users increases, the system must scale to handle more traffic.
There are two major approaches:
- Vertical Scaling (Scale Up)
- Horizontal Scaling (Scale Out)
Vertical scaling means increasing the resources of a single server.
- More RAM
- Faster CPU
- More Storage
- Better Hardware
Before
- 4 GB RAM
- 2 CPU Cores
After
- 32 GB RAM
- 8 CPU Cores
- Easy to implement
- No major architectural changes
- Hardware limit exists
- Expensive
- Single point of failure
Modern CPUs contain multiple cores.
- Dual Core = 2 Cores
- Quad Core = 4 Cores
- Octa Core = 8 Cores
A Quad Core CPU can execute multiple tasks simultaneously.
Examples include:
- Processing API requests
- Running background jobs
- Database operations
- Handling user sessions
More CPU cores generally improve parallel processing capability.
Older storage technology.
- Parallel data transfer
- Large ribbon cables
- Slower performance
Modern replacement for PATA.
- Serial communication
- Faster data transfer
- Better cable management
- Common in HDDs and SSDs
Enterprise-grade storage interface.
- High reliability
- Better performance
- Used in data centers
- Supports larger workloads
Mechanical storage device.
- Moving parts
- Slower read/write speeds
- Lower cost
Flash-based storage.
- No moving parts
- Much faster performance
- Lower latency
- Better reliability
| HDD | SSD |
|---|---|
| Mechanical | Solid State |
| Slower | Faster |
| Cheaper | More Expensive |
| Higher Latency | Lower Latency |
For modern web applications and databases, SSDs are preferred.
DNS translates human-readable domain names into IP addresses.
google.com
↓
142.250.x.x
Humans remember:
- google.com
- amazon.com
Computers communicate using:
- IP Addresses
DNS acts as the Internet's phonebook.
User Browser
↓
DNS Resolver
↓
DNS Server
↓
IP Address Returned
↓
Browser Connects to Website
Horizontal scaling means adding multiple servers instead of upgrading a single server.
Instead of:
1 Server
- 64 GB RAM
Use:
4 Servers
- 16 GB RAM each
- Better fault tolerance
- Higher availability
- Easier growth
- No single server dependency
- More complex architecture
- Requires load balancing
A Load Balancer distributes incoming requests across multiple servers.
Users
│
▼
Single Server
│
Server Overload
Users
│
▼
Load Balancer
/ | \
▼ ▼ ▼
Server 1 Server 2 Server 3
- Distribute traffic
- Detect unhealthy servers
- Improve availability
- Prevent server overload
Traffic can also be routed based on responsibility.
Examples:
- Image Server
- Video Server
- API Server
- Authentication Server
- Static File Server
This improves performance and resource utilization.
Round Robin is one of the simplest load balancing strategies.
Requests are distributed sequentially.
Request 1 → Server A
Request 2 → Server B
Request 3 → Server C
Request 4 → Server A
Request 5 → Server B
Request 6 → Server C
- Simple
- Easy to implement
- Fair distribution
- Does not consider current server load
- Assumes all servers have equal capacity
- FTP transfers files but is not secure.
- SFTP provides secure encrypted file transfer using SSH.
- VPS offers dedicated virtual resources for hosting applications.
- Vertical Scaling increases the resources of a single server.
- Horizontal Scaling adds more servers to handle increased traffic.
- SSDs provide significantly better performance than HDDs.
- DNS converts domain names into IP addresses.
- Load Balancers distribute traffic across multiple servers.
- Round Robin is a simple load balancing algorithm.
- Large-scale systems commonly use Horizontal Scaling + Load Balancers for high availability and scalability.
Round Robin is a load balancing algorithm that distributes incoming requests across multiple servers in sequence.
Example:
Request 1 -> Server 1
Request 2 -> Server 2
Request 3 -> Server 3
Request 4 -> Server 1
...
Suppose a user logs in through Server 1.
If the session data is stored only on Server 1 and the next request is routed to Server 2, then Server 2 cannot find the user's session.
Result:
- User may be logged out.
- User may need to authenticate again.
This problem occurs because the session is stored locally on one server.
Sticky Sessions (Session Affinity) ensure that once a user connects to a server, all future requests from that user are routed to the same server.
Example:
User A ↓ Load Balancer ↓ Server 1
Every future request from User A goes to Server 1.
- Easy to implement.
- No shared session storage required.
- Poor load balancing.
- If the server crashes, the user's session is lost.
- Difficult to scale horizontally.
Instead of storing sessions inside individual servers, store them in a centralized location.
Example technologies:
- Redis
- Memcached
- MySQL
- NFS
- SAN (Storage Area Network)
Now every application server can access the same session data.
Flow:
User ↓ Load Balancer ↓ Any Server ↓ Shared Session Storage
This removes the need for Sticky Sessions.
- Stored on the client's browser.
- Small amount of data.
- Sent with every HTTP request.
- Can store a Session ID.
- Stored on the server.
- Usually identified using a Session ID stored inside a cookie.
- More secure than storing user data directly in cookies.
RAID combines multiple hard disks to improve:
- Performance
- Fault tolerance
- Availability
Different RAID levels provide different trade-offs.
- Disk Striping
- Fastest performance
- No redundancy
- If one disk fails, all data is lost.
Use Case:
- Temporary data
- Gaming
- High-speed workloads
- Disk Mirroring
- Two identical copies of data
- If one disk fails, the other still contains all data.
Advantages:
- High reliability
- Easy recovery
Disadvantages:
- 50% storage efficiency.
Example:
2 × 1TB disks
Usable Storage = 1TB
- Striping + Distributed Parity
- Minimum 3 disks.
- Can tolerate one disk failure.
- Good balance of performance and reliability.
- Similar to RAID 5
- Uses double parity.
- Minimum 4 disks.
- Can survive two disk failures.
Combination of:
- RAID 1 (Mirroring)
- RAID 0 (Striping)
Provides:
- High performance
- High availability
Requires at least 4 disks.
Used in high-performance database servers.
Caching stores frequently accessed data in memory to reduce database queries and improve response time.
Benefits:
- Lower latency
- Reduced database load
- Faster response time
Popular caching systems:
- Redis
- Memcached
Note:
Older versions of MySQL had a Query Cache, but it has been removed in MySQL 8. Modern systems prefer Redis or Memcached.
Large systems often use multiple databases instead of a single database.
Reasons:
- Better scalability
- High availability
- Fault tolerance
Common techniques:
One Primary database
↓
Multiple Read Replicas
Writes go to the Primary.
Reads can be distributed among replicas.
Split data across multiple databases.
Example:
Database 1 → Users A–H
Database 2 → Users I–P
Database 3 → Users Q–Z
This allows the system to handle much larger datasets.