ACM-SW study materials
ACM-SW study resources

Architectural Trade-offs for a High-Frequency Trading System

ACM-SW · Put your knowledge to work in context.

All case studies

Architectural Trade-offs for a High-Frequency Trading System

A fintech startup is building a high-frequency trading platform. The system must process market data and execute trades within 100 microseconds. The team is considering a monolithic architecture with in-memory processing versus a microservices architecture with inter-service communication via a message bus. The monolithic approach promises lower latency but makes it harder to scale individual components and update independently. The microservices approach offers scalability and independent deployment but introduces network overhead. The team has 10 developers, mostly experienced with monolithic systems. The project timeline is 9 months to MVP. Regulatory requirements demand auditability of all trades and the ability to reconstruct the state at any point in time.

1. Evaluate the architectural alternatives against the quality attributes and recommend an approach, justifying your choice.

Read the worked answer

Quality attributes: latency (<100µs), scalability, modifiability, auditability. Monolithic in-memory: likely meets latency, simpler for team, but scaling and independent updates harder. Microservices: scalability and modifiability better, but network overhead may violate latency; team lacks experience. Auditability: both can achieve with event logging, but microservices with event sourcing may be natural. Recommendation: Start with a modular monolith with in-memory processing and clear module boundaries, using event sourcing for audit. This meets latency, leverages team skills, and allows later extraction of services if needed. Use asynchronous logging to avoid latency impact. Plan for a phased migration to microservices for non-latency-critical components (e.g., reporting). This balances risk and requirements.

2. How would you ensure auditability and state reconstruction in your chosen architecture?

Read the worked answer

Implement event sourcing: persist all market data inputs and trade commands as immutable events in an append-only log. Use a snapshot mechanism to periodically capture state to reduce replay time. Ensure events are timestamped and sequenced. For audit, provide a query interface to retrieve events by trade ID or time range. Use a separate audit service that consumes events asynchronously to avoid impacting latency. Regularly test state reconstruction by replaying events in a test environment and comparing to production snapshots.