Santekno
Projects/Elasticsearch Deprecation & Voucher Platform Migration
ByteDance logoPart of ByteDance · Software Engineer, Promotion Platform Team
Backend / APILive

Elasticsearch Deprecation & Voucher Platform Migration

Deprecated Elasticsearch for voucher services and migrated to the voucher platform, cutting latency from ~300ms to 100ms with a concurrent worker pool and a dual-layer cache.

2025-elasticsearch-deprecation-voucher · main
# E-Commerce / Infrastructure
$ go -X POST /2025-elasticsearch-deprecation-voucher/v1/sync
→ 201 Created
{ "status": "ok" }
publish 2025-elasticsearch-deprecation-voucher.synced
Role
Backend Engineer
Timeline
2025
Team
2
Domain
E-Commerce / Infrastructure
Stack
8 tech
Status
Live
01

Overview

This project deprecated Elasticsearch — which was used solely for voucher-related services — and migrated those reads to the voucher platform. I ran a minimal-effort technical assessment, redesigned the access flow, and introduced performance improvements that cut request latency from roughly 300ms to 100ms.

A backend has no screens, so its "UI" is the operational surface: latency dashboards, the query API, and the cache/worker-pool flow.

Grafana — latency before/after (~300ms → 100ms)
API contract — voucher query endpoints
Ops view — cache & worker-pool flow
03

Problem & Solution

Problem

Maintaining Elasticsearch only for voucher lookups consumed unnecessary resources for a dependency that was becoming obsolete. Reading directly from source data risked higher latency, so the flow needed to be both leaner in resource usage and faster for callers.

Solution

I migrated voucher reads to the voucher platform and introduced a concurrent worker pool so unrelated data could be fetched asynchronously, backed by a dual-layer cache (Memcached + Redis). Together these reduced latency from ~300ms to 100ms while removing the redundant search infrastructure.

04

Workflow

Three actors interact with the service; the diagrams are written in English to stay consistent across both languages.

flowchart diagram

query

check

fan-out

source data

metrics

Voucher Service

Voucher Service

Memcached + Redis

Worker Pool

Voucher Platform

Prometheus / Grafana

Use case interaction
sequence diagram
Voucher PlatformWorker PoolMemcached / RedisVoucher ServiceVoucher ServiceVoucher PlatformWorker PoolMemcached / RedisVoucher ServiceVoucher Servicerequest voucher datalookup cachemissfan-out unrelated readsfetch source data (async)resultsaggregatedpopulate cacheresponse (~100ms)
Sequence flow
05

Architecture

flowchart diagram

metrics

Voucher Service

Voucher Service · Go

Memcached

Redis

Concurrent Worker Pool

Voucher Platform · Serving Platform

Prometheus / Grafana

System architecture
Architecture notes

voucher-service first checks the Memcached and Redis layers; on a miss it fans work out to a concurrent worker pool that reads source data from the voucher platform (hosted on the internal serving platform) in parallel, then populates the cache before responding. Prometheus/Grafana track the before/after latency profile across the migration.

state diagram

cached

cache miss

worker pool done

populate cache

received

cache_hit

fan_out

aggregated

cached

Request resolution lifecycle
06

Features

Performance
  • Concurrent worker pool
  • Dual-layer cache (Memcached + Redis)
  • Async access to unrelated data
Migration
  • Elasticsearch deprecation
  • Migration to the voucher platform
Reliability
  • Migration to the internal serving platform
  • Post-migration edge-case handling
07

Tech Stack

language
Go
cache
MemcachedRedis
search
Elasticsearch
concurrency
Worker Pool
infra
Serving Platform
observability
PrometheusGrafana
08

Engineering Challenges

01
Reducing latency without a search index

Removing Elasticsearch meant reads had to hit source data directly. Fix: a concurrent worker pool to fan out unrelated reads asynchronously plus a dual-layer Memcached + Redis cache, taking latency from ~300ms down to 100ms.

02
Retiring an obsolete resource safely

Elasticsearch was kept only for voucher use and was becoming obsolete. Fix: a minimal-effort assessment to redesign the flow to read directly from the voucher platform, removing redundant infrastructure and its resource cost.

03
Unexpected issues after the serving-platform migration

Problems surfaced only after the migration to the internal serving platform, despite an initial assumption that everything was resolved. Fix: more comprehensive assessment and edge-case handling to stabilize the service post-cutover.

09

Outcomes

100ms
latency after optimization
−67%
latency reduction
2
cache layers (Memcached + Redis)
0
remaining Elasticsearch dependencies
10

Lessons Learned

This was my first hands-on experience designing concurrent processes across multiple resources, and it grew my interest in performance and concurrency. The serving-platform migration also taught me to anticipate edge cases — issues appeared only after cutover — so thorough, forward-looking assessment matters as much as the optimization itself.

11

Related Santekno Tutorials

Interested in working together?

Order, payment, or high-traffic event pipelines — let's talk architecture and trade-offs.