amaters-server
AmateRS Server Binary
Overview
amaters-server is the main server binary for AmateRS. It integrates all components (Iwato, Yata, Ukehi, Musubi) into a unified server process that can run standalone or in a distributed cluster.
Features
- Unified Server: Single binary with all components
- Configuration: TOML-based with CLI overrides
- Clustering: Multi-node deployment support
- Observability: Metrics, logging, tracing
- Hot Reload: Configuration changes without restart
Installation
# Build from source
# Run
Usage
# Start single-node server
# Start cluster node
# Check status
# Stop gracefully
Configuration
Create config.toml:
[]
= "0.0.0.0:7878"
= "/var/lib/amaters"
= "info"
[]
= "lsm" # "memory" or "lsm"
= "/var/lib/amaters/wal"
= 1024
= 4
[]
= "cpu" # "cpu", "cuda", "metal"
= 10000
= 8
[]
= 1000
= 60000
= "/etc/amaters/server.crt"
= "/etc/amaters/server.key"
[]
= true
= "node-1"
= ["node-2:7878", "node-3:7878"]
= 1000
[]
= 9090
= "localhost:4317"
= "json"
Architecture
amaters-server
├── Config Loader
├── Storage (Iwato)
│ ├── LSM-Tree
│ ├── WAL
│ └── vLog
├── Compute (Yata)
│ ├── Circuit Compiler
│ ├── Optimizer
│ └── Executor
├── Network (Musubi)
│ ├── gRPC Server
│ └── Connection Pool
├── Cluster (Ukehi)
│ ├── Raft
│ └── Sharding
└── Observability
├── Metrics
├── Logging
└── Tracing
Deployment
Standalone Mode
# Development
# Production
Cluster Mode
# Node 1
# Node 2
# Node 3
Docker
FROM rust:1.85-alpine as builder
WORKDIR /build
COPY . .
RUN cargo build --release --bin amaters-server
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /build/target/release/amaters-server /usr/local/bin/
EXPOSE 7878 9090
CMD ["amaters-server", "start"]
Kubernetes
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: amaters
spec:
serviceName: amaters
replicas: 3
selector:
matchLabels:
app: amaters
template:
metadata:
labels:
app: amaters
spec:
containers:
- name: amaters
image: amaters:latest
ports:
- containerPort: 7878
- containerPort: 9090
volumeMounts:
- name: data
mountPath: /var/lib/amaters
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
resources:
requests:
storage: 10Gi
Monitoring
Metrics
Prometheus metrics exposed on /metrics:
# Storage
amaters_storage_ops_total
amaters_storage_latency_seconds
amaters_storage_size_bytes
# Compute
amaters_fhe_operations_total
amaters_fhe_circuit_size
amaters_fhe_execution_seconds
# Network
amaters_network_connections
amaters_network_requests_total
amaters_network_errors_total
# Cluster
amaters_cluster_nodes
amaters_cluster_leader
amaters_cluster_raft_term
Health Checks
# HTTP health endpoint
# gRPC health check
Performance Tuning
CPU-Bound Workloads
- Increase
bootstrap_threads - Enable parallel compaction
- Use CPU affinity
I/O-Bound Workloads
- Increase
cache_size_mb - Use faster storage (NVMe)
- Enable io_uring (Linux)
Network-Bound
- Increase
max_connections - Enable QUIC
- Use connection pooling
Troubleshooting
Server won't start
- Check port availability:
netstat -an | grep 7878 - Verify config syntax:
amaters-server validate-config - Check logs:
journalctl -u amaters -f
Slow queries
- Enable tracing:
log_level = "debug" - Check metrics:
curl localhost:9090/metrics - Profile with flamegraph
Cluster issues
- Check connectivity:
telnet node-2 7878 - Verify leader:
amaters-server status - Check Raft logs
License
Licensed under MIT OR Apache-2.0
Authors
COOLJAPAN OU (Team KitaSan)