Why we use nginx? • Scalable • serve over 10K connections always per 1 instance • Flexible • TLS Termination, Reverse Proxy, Load Balancing(L4 / L7), Content Caching, and so on… • Extensible • developer can extend nginx with C, Lua, JavaScript, mruby, … • selects C and Lua
Why we use Go? • Simple • build and deployment • Enough • scalability, robustness, productivity • Powerful • concurrency support with goroutine and channel
Building scalable infrastructure with nginx and Go • has been building scalable infrastructure with nginx and Go • Gaurun - Push infrastructure • Pascal - Log analysis infrastructure • Widebullet - API gateway • etc… (Some infrastructure is powered by gRPC)
Gaurun - Push infrastructure • The events in are notified to users. • Purchase, Like, Comment, Shipment, … • Push notification to all users at once? • Over a few tens of millions pushʂ • High performance and scalability are required for pushing quickly
Gaurun • Push notification server in Go • github.com/mercari/gaurun • Provides HTTP APIs for push and metrics • Supports GCM and APNs ( HTTP/2, too) • Scalable • In , a few Gaurun instances process all pushes.
PascalʙLog analysis infrastructureʙ • Built with the software blocks below • Puree, OpenResty (ngx_lua), Fluentd, fluent-agent-hydra, Google BigQuery • Aggregate various logs to Google BigQuery • Event in app • A/B Testing • etc…
• Low resource usage is required • Pascal indicates modestly high workload • OpenResty processes a lot of JSONs and outputs various logs • Requests are come from not only device but internal subsystems (e.g. API). • OpenResty and fluent-agent-hydra are very fast and efficient PascalʙLog analysis infrastructureʙ
Widebullet - API gateway • In , subsystems have been increased day by day. • some subsystem must call multiple APIs at once • Call APIs concurrently for high performance • Widebullet proxies multiple API calls at once
Summary • has been building scalable infrastructure with nginx and Go • Why we use nginx and Go? • nginx • Scalable, Flexible, Extensible • Go • Simple, Enough, Powerful • These infrastructures are constructed by SREs and Backend System Engineers