I'm building an adaptive authentication system that is meant to calculate risk score for…
- User
I'm building an adaptive authentication system that is meant to calculate risk score for a given login attempt by analysing the login context like time of day, user agent, get location, keystroke dynamics, etc. this analysis is done by finding anomalies of the current login data when fitted against historical data for that particular user using machine learning. Based on this information and only this information, gauge how many and how big of a server will you need for application and DB to process 3000 transactions a second. Make appropriate assumptions where necessary and give an optimised quote
- Assistant
To determine the server requirements for processing 3,000 transactions per second (TPS) in your adaptive authentication system, we'll need to make several informed assumptions about the computational and storage demands of each transaction. We'll consider both the application servers (handling the computation and analysis) and the database servers (handling data storage and retrieval).
Assumptions:
-
User Base and Data Volume:
- Number of Users: Let's assume 100,000 active users.
- Historical Data per User: We store the most recent 50 login attempts per user.
- Data Size per Login Attempt: Approximately 400 bytes (including timestamp, user agent, location data, and keystroke dynamics).
-
Per Transaction Operations:
- Data Read per Transaction: Fetch the user's 50 most recent login attempts (~20 KB).
- Data Write per Transaction: Store the new login attempt (~400 bytes).
- Processing Time per Transaction: Approximately 5 milliseconds of CPU time (includes fetching data, feature extraction, and anomaly detection).
-
System Throughput Requirements:
- Total Data Read: 3,000 TPS × 20 KB = 60 MB/sec.
- Total Data Write: 3,000 TPS × 400 bytes = ~1.2 MB/sec.
- CPU Time: 3,000 TPS × 5 ms = 15,000 ms/sec (distributed across CPU cores).
Application Servers Estimation:
- CPU Requirements:
- Processing Capacity per Core: 1,000 ms/sec ÷ 5 ms/transaction = 200 TPS per core.
- Total Cores Needed: 3,000 TPS ÷ 200 TPS per core = 15 cores.
- Server Specification: Opt for servers with at least 16 CPU cores to meet the demand with some headroom.
- Memory Requirements:
- Per Transaction Memory Usage: Minimal, but sufficient RAM is needed for efficient processing and caching.
- Total RAM per Server: 32 GB to handle the processing needs and potential in-memory caching.
- Server Count and Configuration:
- Number of Application Servers: 2 servers (for redundancy and load balancing).
- Specification per Server:
- CPU: 16-core processor.
- RAM: 32 GB.
- Storage: SSD for OS and applications (application servers primarily handle processing, not heavy storage).
Database Servers Estimation:
- I/O Operations:
- Read Operations: 3,000 reads/sec.
- Write Operations: 3,000 writes/sec.
- Total IOPS: 6,000 IOPS (assuming one read and one write per transaction).
- Storage Requirements:
- Total Data Storage: 100,000 users × 50 login attempts × 400 bytes = ~2 GB (manageable, but we should provision for growth).
- Storage Type: High-performance SSD to handle the IOPS and throughput requirements.
- CPU and Memory Requirements:
- CPU: 16-core processor to handle query processing and concurrency.
- RAM: 64 GB to cache frequently accessed data and improve read/write performance.
- Server Count and Configuration:
- Number of Database Servers: 2 servers (for high availability and failover).
- Specification per Server:
- CPU: 16-core processor.
- RAM: 64 GB.
- Storage: 1 TB high-performance SSD.
Optimized Server Quote:
Application Servers:
- Quantity: 2 Servers
- Per Server Specifications:
- CPU: 16-core processor (e.g., Intel Xeon or AMD EPYC).
- RAM: 32 GB DDR4.
- Storage: 256 GB SSD for OS and applications.
- Network: Gigabit Ethernet with load balancing capability.
Database Servers:
- Quantity: 2 Servers
- Per Server Specifications:
- CPU: 16-core processor.
- RAM: 64 GB DDR4.
- Storage: 1 TB NVMe SSD for high IOPS.
- Network: Gigabit Ethernet with failover support.
Additional Considerations:
- Load Balancing: Implement a load balancer in front of the application servers to distribute incoming requests evenly.
- High Availability: Configure database servers in a master-slave setup or use clustering for automatic failover.
- Scalability: Ensure that the architecture allows for horizontal scaling (adding more servers) if the transaction rate increases.
- Caching Mechanisms: Utilize in-memory caching (e.g., Redis or Memcached) to reduce database load for frequently accessed data.
- Optimization of Code and Queries: Ensure that the application code and database queries are optimized for performance to make efficient use of the hardware.
Summary:
- Total Servers Needed: 4 (2 Application Servers + 2 Database Servers).
- Total CPU Cores: 64 cores (32 cores for application servers, 32 cores for database servers).
- Total RAM: 192 GB (64 GB for application servers, 128 GB for database servers).
- Total Storage: 2.5 TB SSD (0.5 TB for application servers, 2 TB for database servers).
This configuration should efficiently handle 3,000 transactions per second with room for redundancy, failover, and minor traffic spikes. It balances performance and cost by using servers with sufficient resources without excessive over-provisioning.
Note: Actual performance can vary based on factors like network latency, the efficiency of the code, and the specific machine learning algorithms used. It's advisable to conduct performance testing and monitoring to fine-tune the system after deployment.
-