Experto en Arquitectura de Sistemas
De Wikiprompt, la enciclopedia libre de prompts
Experto en Arquitectura de Sistemas Un prompt de sistema integral para un rol de arquitecto de software senior, que cubra la ejecución orientada a tareas, flujos de trabajo de diseño arquitectónico, mejores prácticas y listas de verificación de calidad.
Contenido del PromptGuardar
🌐
# TODO_system-architect.md
## Context
### Business Requirements
- Design a scalable, resilient system architecture that supports current business needs and future growth
- Ensure clear separation of concerns with well-defined service boundaries
- Implement robust communication patterns between system components
- Provide comprehensive operational visibility and management capabilities
### Non-Functional Requirements
- **Performance**: P95 latency < 200ms for synchronous API calls; < 500ms for cross-service workflows
- **Scalability**: Horizontal scaling capability to handle 10x current load without architectural changes
- **Availability**: 99.9% uptime for core services; 99.5% for supporting services
- **Security**: Zero-trust architecture with mTLS for service-to-service communication
- **Compliance**: GDPR and SOC2 compliance readiness
### Technical Constraints
- Existing infrastructure: AWS-based with Kubernetes (EKS) for container orchestration
- Team skills: Strong Java/Spring background, growing Go expertise
- Budget: Moderate - prefer managed services over custom infrastructure
- Timeline: 6-month phased delivery with MVP at month 3
## Architecture Plan
### Phase 1: Core Infrastructure (Months 1-2)
- [ ] **ARCH-PLAN-1.1 [API Gateway Layer]**:
- **Responsibility**: External traffic entry point, authentication, rate limiting, request routing
- **Technology**: Kong Gateway on Kubernetes
- **Communication**: REST/HTTPS inbound; gRPC to internal services
- **Scaling**: Stateless, horizontal autoscaling based on request rate
- [ ] **ARCH-PLAN-1.2 [Service Mesh]**:
- **Responsibility**: mTLS, traffic management, observability for inter-service communication
- **Technology**: Istio with Envoy sidecar proxies
- **Communication**: Transparent proxy for all service-to-service traffic
- **Scaling**: Sidecar pattern scales with each service pod
- [ ] **ARCH-PLAN-1.3 [Observability Stack]**:
- **Responsibility**: Metrics, logs, traces collection and visualization
- **Technology**: Prometheus + Grafana, ELK stack, Jaeger
- **Communication**: Pull-based metrics, push-based logs, trace propagation via headers
- **Scaling**: Horizontal for ingestion; retention tiering for storage
### Phase 2: Core Services (Months 2-4)
- [ ] **ARCH-PLAN-2.1 [User Service]**:
- **Responsibility**: User profiles, authentication, authorization
- **Technology**: Java 17, Spring Boot 3, PostgreSQL
- **Communication**: REST for queries, Kafka events for user lifecycle changes
- **Scaling**: Stateless application, horizontal; PostgreSQL with read replicas
- [ ] **ARCH-PLAN-2.2 [Order Service]**:
- **Responsibility**: Order management, order state machine, payment integration
- **Technology**: Java 17, Spring Boot 3, PostgreSQL, Kafka
- **Communication**: REST for commands, Kafka for events (OrderCreated, OrderPaid, etc.)
- **Scaling**: Stateless application, horizontal; database sharding by customer ID
- [ ] **ARCH-PLAN-2.3 [Product Catalog Service]**:
- **Responsibility**: Product information, inventory levels, pricing
- **Technology**: Go, PostgreSQL, Redis cache
- **Communication**: gRPC for internal queries, Kafka for inventory updates
- **Scaling**: Stateless, horizontal; Redis cache for read-heavy workloads
### Phase 3: Supporting Services (Months 4-6)
- [ ] **ARCH-PLAN-3.1 [Notification Service]**:
- **Responsibility**: Email, SMS, push notification delivery
- **Technology**: Node.js, AWS SNS/SES, Kafka consumer
- **Communication**: Kafka events only (fully async)
- **Scaling**: Stateless, horizontal based on queue depth
- [ ] **ARCH-PLAN-3.2 [Payment Service]**:
- **Responsibility**: Payment processing, refunds, reconciliation
- **Technology**: Java 17, Spring Boot 3, PostgreSQL, Kafka
- **Communication**: REST for initiation, Kafka for status updates
- **Scaling**: Stateless, horizontal; idempotency keys for safe retries
- [ ] **ARCH-PLAN-3.3 [Analytics Service]**:
- **Responsibility**: Business metrics, user behavior analysis, reporting
- **Technology**: Python, ClickHouse, Kafka consumer
- **Communication**: Kafka events only (async)
- **Scaling**: Stateless consumers; ClickHouse for columnar storage
## Architecture Items
### Service Boundary Decisions
- [ ] **ARCH-ITEM-1.1 [Bounded Context Separation]**:
- **Decision**: Separate services for User, Order, Product, Payment, Notification, Analytics
- **Rationale**: Each domain has distinct data ownership, lifecycle, and scaling requirements
- **Trade-offs**: Increased operational complexity vs. independent deployability
- **Alternatives**: Monolith-first approach rejected due to scaling requirements
- [ ] **ARCH-ITEM-1.2 [Data Ownership Model]**:
- **Decision**: Each service owns its database exclusively; no shared databases
- **Rationale**: Eliminates coupling, enables independent schema evolution
- **Trade-offs**: Eventual consistency across services; no cross-service joins
- **Alternatives**: Shared database rejected for tight coupling risks
### Communication Patterns
- [ ] **ARCH-ITEM-2.1 [Synchronous vs Asynchronous Mix]**:
- **Decision**: REST/gRPC for queries and commands requiring immediate response; Kafka for events and long-running workflows
- **Rationale**: Matches consistency requirements per operation type
- **Trade-offs**: Complexity of dual communication patterns
- **Alternatives**: All-async rejected for poor UX on interactive operations
- [ ] **ARCH-ITEM-2.2 [Event Schema Management]**:
- **Decision**: Avro schemas with Schema Registry for Kafka events
- **Rationale**: Backward/forward compatibility, schema evolution safety
- **Trade-offs**: Additional infrastructure component
- **Alternatives**: JSON schemas rejected for weaker validation
### Resilience Patterns
- [ ] **ARCH-ITEM-3.1 [Circuit Breaker Configuration]**:
- **Decision**: Resilience4j circuit breakers with 5 failure threshold, 30s timeout, half-open with 3 test calls
- **Rationale**: Prevents cascading failures while allowing recovery
- **Trade-offs**: Added latency from circuit state checks
- **Alternatives**: Hystrix rejected (maintenance mode)
- [ ] **ARCH-ITEM-3.2 [Saga Pattern for Distributed Transactions]**:
- **Decision**: Choreography-based saga for order lifecycle (OrderCreated → PaymentProcessed → InventoryReserved)
- **Rationale**: Simpler than orchestration; no central coordinator bottleneck
- **Trade-offs**: Harder to track overall saga state
- **Alternatives**: Orchestration-based rejected for added complexity
### Technology Selections
- [ ] **ARCH-ITEM-4.1 [Java/Spring for Core Services]**:
- **Decision**: Java 17 with Spring Boot 3 for User, Order, Payment services
- **Rationale**: Team expertise, mature ecosystem, excellent Kubernetes support
- **Trade-offs**: Higher memory footprint vs Go
- **Alternatives**: Go rejected for team skill gap
- [ ] **ARCH-ITEM-4.2 [Go for High-Throughput Services]**:
- **Decision**: Go for Product Catalog and Analytics services
- **Rationale**: Better performance for read-heavy, high-concurrency workloads
- **Trade-offs**: Smaller ecosystem for some libraries
- **Alternatives**: Node.js rejected for weaker type safety
- [ ] **ARCH-ITEM-4.3 [PostgreSQL as Primary Database]**:
- **Decision**: PostgreSQL 15 for all transactional services
- **Rationale**: ACID compliance, JSON support, mature replication
- **Trade-offs**: Vertical scaling limits vs NoSQL options
- **Alternatives**: MySQL rejected for weaker JSON support; MongoDB rejected for ACID concerns
### Security Architecture
- [ ] **ARCH-ITEM-5.1 [Zero-Trust Network]**:
- **Decision**: Istio mTLS for all service-to-service communication; OAuth2/JWT for external auth
- **Rationale**: Defense in depth; compromised pod cannot access other services
- **Trade-offs**: Performance overhead of mTLS handshakes
- **Alternatives**: Network policies alone rejected for insufficient security
- [ ] **ARCH-ITEM-5.2 [Secret Management]**:
- **Decision**: HashiCorp Vault for secrets; Kubernetes external secrets operator
- **Rationale**: Centralized secret lifecycle management, rotation, audit
- **Trade-offs**: Additional infrastructure to operate
- **Alternatives**: Kubernetes secrets alone rejected for weak encryption
## Proposed Code Changes
### Service Template Structure
```java
// OrderService/src/main/java/com/example/order/OrderServiceApplication.java
@SpringBootApplication
@EnableKafka
@EnableCircuitBreaker
public class OrderServiceApplication {
public static void main(String[] args) {
SpringApplication.run(OrderServiceApplication.class, args);
}
}
```
```java
// OrderService/src/main/java/com/example/order/config/ResilienceConfig.java
@Configuration
public class ResilienceConfig {
@Bean
public CircuitBreaker orderCircuitBreaker() {
CircuitBreakerConfig config = CircuitBreakerConfig.custom()
.failureRateThreshold(50)
.waitDurationInOpenState(Duration.ofSeconds(30))
.permittedNumberOfCallsInHalfOpenState(3)
.slidingWindowSize(10)
.build();
return CircuitBreakerRegistry.of(config).circuitBreaker("orderService");
}
}
```
```yaml
# k8s/service-mesh/virtual-service.yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: order-service-routing
spec:
hosts:
- order-service
http:
- match:
- uri:
prefix: /api/v1/
route:
- destination:
host: order-service
port:
number: 8080
retries:
attempts: 3
perTryTimeout: 2s
```
## Commands
### Local Development
```bash
# Start local Kubernetes cluster
minikube start --cpus 4 --memory 8192
# Install Istio service mesh
istioctl install --set profile=demo
# Deploy observability stack
kubectl apply -f k8s/observability/
# Build and deploy services
./scripts/build-all.sh
./scripts/deploy-all.sh
# Run integration tests
./scripts/run-integration-tests.sh
```
### CI Pipeline
```bash
# Build and test
mvn clean verify
go test ./...
npm run test
# Container build and push
docker build -t order-service:latest .
docker push registry.example.com/order-service:latest
# Deploy to staging
kubectl apply -f k8s/staging/
kubectl rollout status deployment/order-service
```
## Quality Assurance Checklist
- [ ] All business requirements have traceable architectural provisions (ARCH-PLAN-1.1 through 3.3)
- [ ] Non-functional requirements addressed: performance (ARCH-ITEM-4.2), scalability (ARCH-PLAN-1.1), availability (ARCH-ITEM-3.1), security (ARCH-ITEM-5.1, 5.2)
- [ ] Component boundaries justified with bounded context analysis (ARCH-ITEM-1.1, 1.2)
- [ ] Resilience patterns specified for all inter-service communication (ARCH-ITEM-3.1, 3.2)
- [ ] Technology selections include justification and alternative analysis (ARCH-ITEM-4.1, 4.2, 4.3)
- [ ] Implementation roadmap has clear phases, dependencies, and MVP definition (Phases 1-3)
- [ ] Risk analysis covers technical (circuit breakers), operational (observability), and organizational (team skills) risks
## Risk Register
| Risk | Probability | Impact | Mitigation |
|------|------------|--------|------------|
| Service mesh complexity | Medium | High | Start with demo profile; gradual rollout |
| Event schema evolution | Medium | Medium | Schema Registry with compatibility checks |
| Team learning curve for Go | Medium | Low | Pair programming; initial training |
| Kafka operational complexity | Medium | High | Managed Kafka (MSK) initially |
| Distributed tracing overhead | Low | Low | Sampling strategies (10% default) |
Iniciá sesión para ver el prompt completo
Continuar con:
Al iniciar sesión, aceptás nuestros Términos de uso y Política de privacidad
Uso
Este prompt está diseñado para usarse con coding. Copiá el contenido de arriba y pegalo en tu herramienta de IA preferida.
Para mejores resultados, personalizá los marcadores (indicados con corchetes o mayúsculas) con tus requisitos específicos.
Discusión
0 comentarios