How We Cut Search Latency by 80% with an AWS Cloud‑Native Architecture
This article details a step‑by‑step AWS cloud‑native solution that combines 10 Gbps internal networking, Elasticsearch distributed indexing, Windows Server tuning, SQL Server read‑write splitting, and intelligent load‑balancing to reduce search latency by 80 % and boost database throughput by 300 % under million‑level concurrency.
Infrastructure Layer Optimization
1.1 AWS Placement Group
Network topology : Use a Cluster Placement Group to provide a dedicated 10 Gbps backbone between EC2 instances.
Configuration code :
aws ec2 create-placement-group \
--group-name easybom-net-group \
--strategy cluster \
--region us-west-1Performance verification : iperf3 test shows a transfer of 11.2 GB over 10 seconds, achieving 9.62 Gbits/sec.
1.2 OS‑Level Tuning (Windows Server)
Key parameters were adjusted to improve TCP handling, memory locking, and power settings.
TCP connections : Default 1000 → Optimized 10000 (Set‑NetTcpSetting -SettingName InternetCustom -MaxSynRetransmissions 10)
Memory lock pages : Disabled → Enabled (LockPagesInMemory=1 for SQL Server)
Power plan : Balanced → High performance (powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c)
Elasticsearch Cluster Construction Guide
2.1 Node Expansion Steps
Freeze existing cluster to prevent shard migration:
{
"persistent": {
"cluster.routing.rebalance.enable": "none"
}
}Securely add new nodes with core elasticsearch.yml settings:
discovery.seed_hosts: ["172.31.88.146:9300", "172.31.88.61:9300"]
cluster.initial_master_nodes: ["node-1", "node-2"]
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12Certificate issuance (Let’s Encrypt example shown later).
2.2 Performance Monitoring Metrics
Key visual dashboards (shown in the original images) illustrate cluster health and query latency.
indices.breaker.total.limit: 70% thread_pool.search.size: 2 * cores + 1SQL Server Read/Write Splitting
3.1 Publication/Subscription Matrix
Sync method : Transactional replication (primary DB priority, read‑only DB immediate update).
Conflict handling : Primary‑first, automatic rollback on the read‑only side.
Bandwidth usage : Compressed SMB 3.1.1 for primary, decompressed on replica.
3.2 Migration Checklist
Pre‑condition verification (check tables without primary keys):
SELECT name FROM sys.tables WHERE object_id NOT IN (
SELECT parent_obj FROM sys.key_constraints
);Publication configuration script :
EXEC sp_addpublication @publication='EasyBom_Repl',
@sync_method='database snapshot',
@repl_freq='continuous';Fail‑over test (simulate primary outage):
# PowerShell
Stop-Service MSSQLSERVER -Force
# Verify read‑only routing (max 15 s latency)Intelligent Load Balancing
4.1 Cloudflare Rule Configuration
{
"rules": [
{
"name": "Asia_Traffic",
"condition": "ip.src.region eq 'APAC'",
"action": "route_to_origin(origin='tokyo-edge')"
},
{
"fallback": "global_health_check",
"monitor": "http://172.31.88.211:9200/_cluster/health"
}
]
}4.2 Certificate Management Automation
# Renew Let’s Encrypt wildcard certificate
certbot certonly \
--dns-cloudflare \
--dns-cloudflare-credentials ~/cloudflare.ini \
-d '*.easybom.com'Deep Monitoring System
5.1 Alert Thresholds
ES JVM heap – warning 75 %, critical 85 % (check every 30 s)
SQL lock wait – warning 5 %, critical 15 % (check every 1 min)
Internal network latency – warning 2 ms, critical 5 ms (check every 10 s)
5.2 Log Analysis Command
# High‑frequency query analysis in Elasticsearch
GET _search/template
{
"id": "slow_query_analysis",
"params": {"threshold": "100ms"}
}Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Code Wrench
Focuses on code debugging, performance optimization, and real-world engineering, sharing efficient development tips and pitfall guides. We break down technical challenges in a down-to-earth style, helping you craft handy tools so every line of code becomes a problem‑solving weapon. 🔧💻
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
