about eureka
- pairs - over 3,500,000 users
- Japan & Taiwan
129݄ 133݄ 139݄ 143݄ 149݄ 153݄
225ສ
135ສ
45ສ
90ສ
190ສ
3.5 year
over
3,500,000
Slide 3
Slide 3 text
- Members
- 50 engineers
- 54 non engineers
Slide 4
Slide 4 text
about me
- Masashi Salvador Mitsuzawa
- Senior Engineer @ eureka
- Monetization Team Leader / Server Side Engineer Leader
- Love #Curry #Haskell #Golang #Algorithm #MachineLearning
- see : #ΧϨʔ৯͏ͨΊʹੜ͖ͯΔ @instagram
- Twitter: @MasashiSalvador
- Major : Computational Neuroscience @ Graduate School
- 2013 - 2015 DeNA
- 2015 - current eureka
Slide 5
Slide 5 text
Outline
• Why Go?
• Architecture of pairs
• Microservices
• Structure of application
• Libraries
• Golang TIPS in pairs
Slide 6
Slide 6 text
Outline
• Why Go?
• Architecture of pairs
• Microservices
• Structure of application
• Libraries
• Golang TIPS in pairs
Slide 7
Slide 7 text
pairs:
- About pairs Go Project
- Over 1 year project
- Data migration (schema change)
- Full-scratch the entire codebase
- Background
- huge tech debt (including design debt)
- Monolith architecture
- DB (unscalable / strange schema)
- Tightly Coupled
- Technical Challenge
Slide 8
Slide 8 text
Why Go?
- Minimum syntax (minimum Spec)
- bundle with formatter
- easy to learn
- able to keep clean codebase
- easy to read! (important : able to read all OSS code)
- Static Typing
- Safe
- High Performance
- Concurrency
- goroutine / channel
- Good Standard Libraries (net/http, database/sql)
Slide 9
Slide 9 text
Why NOT Go?
- No “Modern” Syntax
- map / reduce
- No Class syntax
- No Exception
- Less established Libraries and frameworks
- WAF(gin? revel? beego? echo?)
- testing
- ORM
Slide 10
Slide 10 text
But We love
- new language
- challenging
- creating new standard
- at the same time engineers’ growing up
Slide 11
Slide 11 text
then we chose Go
Slide 12
Slide 12 text
Outline
• Why Go?
• Architecture of pairs
• Microservices
• Structure of application
• Libraries
• Golang TIPS in pairs
Slide 13
Slide 13 text
Microservices
EJBHSBNESBXOCZ!LBOFTIJO
Slide 14
Slide 14 text
Microservices
- Service Oriented Architecture (All written in Golang)
- pairs.lv
- admin
- search
- batch
- payment
- surveillance
- Stack
- gin(pairs.lv) / goji(payment)
- Elasticsearch
- MySQL
- Redis(cache) / DynamoDB
- Ansible(provision, build, deploy)
Slide 15
Slide 15 text
Response
Request
Structure
Controller Facade Service Repository
Entity
- Basically structured as MVC
Libraries
View
URL routing
JSON
SPA
AngularJS + TypeScript
DB
Slide 16
Slide 16 text
Response
Request
Structure
Controller Facade Service Repository
Entity
- Basically structured as MVC
Libraries
View
URL routing
JSON
SPA
AngularJS + TypeScript
DB
Core Library
Outline
• Why Go?
• Architecture of pairs
• Microservices
• Structure of application
• Libraries
• Golang TIPS in pairs
Slide 19
Slide 19 text
go generate
- go generate
Slide 20
Slide 20 text
go generate
- go generate
Slide 21
Slide 21 text
go generate
- handing with routing
- gin default (from README.md)
- how to handle with many routing and controllers?
Slide 22
Slide 22 text
go generate
- handing with routing
- naively (like many WAFs)
main.go config/route
mapping URL -> controller
- a way to realize it in Go
generator/main.go
routes/api_xxx_v1.tml
api_yyy_v1.tml
api_zzz_v1.tml
Read
Read
app/main_gen.go
routes_gen.go
Generate
Slide 23
Slide 23 text
go generate
- in routes_gen.go
- generator/main.go: pattern written in go template
Slide 24
Slide 24 text
package vendoring
- nuts (previous)
eure/eure-go
cloned from repositories
pinned commit-hash
app.go
go get github.com/eure/eure-go
import “github.com/eure/eure-go/
vendor/_nuts/github.com/revel/revel"
import
ginkgo -> standard library
- Why NOT ginkgo?
- heavy
- Rspec Syntax
- JustBeforeEach, BeforeEach, JustBefore, Before
- not like Golang
- members’ unfamiliar with RSpec
- Standard testing + testify
Slide 27
Slide 27 text
Mines …
- Default Values
- Slice append
- packaging (unfamiliar with LL lang users)
- gophers love bare net/http too much :)