Quality Attributes
Non-functional requirements define how well the system performs its functions. They describe the quality attributes of the system.
Core Quality Attributes
Non-Functional Requirements
├── Scalability
├── Availability
├── Reliability
├── Performance
├── Security
├── Maintainability
├── Portability
└── Usability
Quality Attributes Overview
| Attribute | Definition | Example Metric |
|---|---|---|
| Scalability | Handle growing load | 10K → 1M users |
| Availability | Uptime percentage | 99.99% uptime |
| Reliability | Correct operation | < 0.01% error rate |
| Performance | Speed of response | < 200ms latency |
| Security | Protection from threats | No data breaches |
| Maintainability | Ease of modification | Changes in < 1 day |
Non-Functional vs Functional
Functional: "User can upload a video"
Non-Functional: "Video upload completes within 5 seconds for files up to 100MB"
Functional: "User can search products"
Non-Functional: "Search results return within 500ms for 99% of queries"
The Illities
Many non-functional requirements end in "-ility":
- Scalability: Can grow
- Availability: Always accessible
- Reliability: Works correctly
- Maintainability: Easy to change
- Portability: Works on different platforms
- Extensibility: Easy to add features
- Testability: Easy to verify
Performance Requirements
Performance requirements specify how fast and efficiently the system must operate.
Key Performance Metrics
Latency
├── Response Time: Time for server to respond
├── Time to First Byte (TTFB): Time until first data received
└── Round Trip Time (RTT): Total time for request-response
Throughput
├── Requests Per Second (RPS)
├── Transactions Per Second (TPS)
└── Data Transfer Rate (MB/s)
Performance Targets
| System Type | Latency Target | Throughput Target |
|---|---|---|
| Real-time Chat | < 100ms | 10K messages/sec |
| E-commerce | < 500ms | 1K orders/sec |
| Search Engine | < 200ms | 100K queries/sec |
| Video Streaming | < 1s startup | 1M streams |
Performance Example: URL Shortener
Performance Requirements:
- URL creation: < 200ms (99th percentile)
- URL redirect: < 50ms (99th percentile)
- Analytics query: < 1s (95th percentile)
- System throughput: 100K redirects/sec
Measuring Performance
Client ──── 10ms ──── Network ──── 5ms ──── Server ──── 50ms ──── Database
(Client) (Network) (Processing) (Query)
Total Response Time = Client + Network + Server + Database
= 10 + 5 + 50 + 50 = 115ms
Performance Optimization Areas
- Network: CDN, compression, HTTP/2
- Server: Caching, connection pooling, async processing
- Database: Indexing, query optimization, read replicas
- Application: Algorithm optimization, lazy loading, pagination
Scalability Requirements
Scalability requirements define how the system handles growing demand.
Types of Scalability
Scalability
├── Vertical Scaling (Scale Up)
│ └── Bigger machines
├── Horizontal Scaling (Scale Out)
│ └── More machines
└── Geographic Scaling
└── More regions
Scalability Metrics
| Metric | Current | Target |
|---|---|---|
| Users | 10K | 10M |
| Requests/sec | 100 | 100K |
| Data Size | 10GB | 10TB |
| Concurrent Connections | 1K | 1M |
Scalability Example: Chat System
Scalability Requirements:
- Support 10M concurrent users
- Handle 100K messages/sec peak
- Store 1B messages (10TB data)
- Scale to 100M users within 2 years
Design Implications:
- Horizontal scaling for stateless services
- Message queue for async processing
- Data partitioning by user ID
- CDN for static assets
When to Specify Scalability
Always specify in system design interviews:
- Current scale: What's the expected starting load?
- Growth rate: How fast will it grow?
- Target scale: What's the maximum expected load?
- Scaling timeline: How quickly do we need to scale?
Scalability vs Performance
Performance = How fast for current load
Scalability = How well it handles increased load
Good Performance + Poor Scalability = Fast now, slow later
Poor Performance + Good Scalability = Slow now, still slow later
Good Performance + Good Scalability = Fast now and later
Practice Problems
Design a scalable Non-Functional Requirements system. Cover high-level architecture, data model, and API design.
Solution
// Complete system design:
// - Functional + Non-functional requirements
// - Capacity estimation
// - Data model (SQL/NoSQL choice)
// - API endpoints
// - Component architecture
// - Scaling strategy
// - Monitoring & reliabilityHow would you scale Non-Functional Requirements to handle 10x the current load? Identify bottlenecks and solutions.
Solution
// Scaling approach:
// 1. Load balancing
// 2. Database sharding/replication
// 3. Cache layer (Redis)
// 4. CDN for static assets
// 5. Async processing (queues)
// 6. Microservices decompositionAnalyze potential failure modes for Non-Functional Requirements and design mitigation strategies.
Solution
// Failure mitigation:
// 1. Redundancy (multi-AZ)
// 2. Circuit breakers
// 3. Retry with backoff
// 4. Dead letter queues
// 5. Health checks
// 6. Graceful degradationQuiz
1. What do non-functional requirements describe?
2. Which is a measurable performance metric?
3. What is the difference between scalability and performance?
4. For a real-time chat system, what latency target is typically acceptable?
Flashcards
Question
What are non-functional requirements?
Click to reveal answer
Answer
Non-functional requirements define HOW WELL the system performs its functions. They describe quality attributes like scalability, availability, reliability, and performance.
Question
Name the core quality attributes of a system.
Click to reveal answer
Answer
Scalability, Availability, Reliability, Performance, Security, Maintainability, Portability, Usability.
Question
What makes a good non-functional requirement?
Click to reveal answer
Answer
It must be measurable and specific. '< 200ms latency' is good. 'The system should be fast' is not.
Question
What's the relationship between performance and scalability?
Click to reveal answer
Answer
Performance is speed at current load. Scalability is handling increased load. You need both for a successful system.
Question
What is Non-Functional Requirements?
Click to reveal answer
Answer
Non-Functional Requirements is a key concept in system design.
Revision Notes
Key Takeaways
- 1.Non-functional requirements define quality attributes, not features
- 2.Always use measurable, specific targets (not vague terms)
- 3.Performance and scalability are related but different concerns
- 4.Balance competing non-functional requirements (e.g., consistency vs availability)
- 5.Specify both current and target scale in interviews
Interview Tips
- •Always ask about expected scale: users, requests/sec, data size
- •Use specific numbers: '< 200ms latency' not 'fast response'
- •Discuss tradeoffs between quality attributes (e.g., consistency vs latency)
Cheat Sheet
Non-Functional Requirements - Cheat Sheet
Definition:
HOW WELL the system performs (quality attributes)
Core Quality Attributes:
| Attribute | What it means |
|---|---|
| Scalability | Handle growing load |
| Availability | Uptime (99.99%) |
| Reliability | Correct operation |
| Performance | Speed of response |
| Security | Protection from threats |
| Maintainability | Ease of modification |
Performance Metrics:
- Latency: Response time
- Throughput: Requests/sec
- TTFB: Time to first byte
Scalability Metrics:
- Current → Target users/requests
- Growth rate
- Timeline for scaling