Upload
guilherme-garnier
View
178
Download
0
Embed Size (px)
Citation preview
A EVOLUÇÃO DE UMAARQUITETURA DISTRIBUÍDA:
DO GLOBO.TV AO GLOBOSAT PLAY
Guilherme Garnier
http://blog.guilhermegarnier.com
@guilhermgarnier
Estamos contratando!http://talentos.globo.com
PLATAFORMA DE VÍDEOS2 M vídeos publicados
500 M videoviews/mês
2011GLOBO.TV
produto de vídeos centralizadoRede Globo e canais Globosattrechos abertos e íntegras para assinantes
ARQUITETURA ORIGINAL
2012NOVAS DEMANDAS
Transmissões ao vivoBig BrotherUFCCampeonato Brasileiro e estaduaisOlimpíadas de inverno
Canal Combate (acervo de lutas)
globotv globotv API
eventos VoD
API API
COMO MANTER A IDENTIDADEVISUAL ENTRE OS PROJETOS?
GLOBOTV-UIBIBLIOTECA DE COMPONENTES
HTML, JS e CSSPadronizaçãoDocumentação
COMPONENTES DO GLOBOTV-UI
2014
Acervo dos canais GlobosatTransmissões ao vivoFilmesLutas
DESAFIOSmanter a consistência entre os projetoscompartilhar APIs e componentesevoluir a plataforma para manter o Globo.TV e receber o Globosat Play
globotv
globotv APIeventos VoD
globosat-play programas filmes
login busca
Globo.tv
Plataforma
GlobosatPlay
API API
APIAPIAPI
EVOLUÇÃO DA ARQUITETURAcódigo de projetos antigos extraído para novos projetosdocumentação de APIs internascódigo comum compartilhado (gems internas)versionamento de APIs
EVOLUÇÃO DA ARQUITETURAARQUITETURA RESILIENTE
Fazer o máximo para manter o site no arFoco nas principais features ("graceful degradation")
EVOLUÇÃO DA ARQUITETURAARQUITETURA RESILIENTE
CacheCircuit breakerMonitoraçãoEscalabilidade
CACHE2 níveis (performance e stale)diferentes tempos para cada serviço
https://github.com/globocom/content-gateway-rubymenu_config = OpenStruct.new( cache: Rails.cache, timeout: 1, cache_expires_in: 30.minutes, cache_stale_expires_in: 2.days)
gateway = ContentGateway::Gateway.new("Menu", menu_config)
gateway.get_json("/api/menu.json")
CIRCUIT BREAKER
CIRCUIT BREAKER
http://martinfowler.com/bliki/CircuitBreaker.html
https://github.com/wsargent/circuit_breaker
MONITORAÇÃOFalhasPerformance
ESCALABILIDADE
EVOLUÇÃO DA INFRACULTURA DEVOPS
Blue-green deployDockerTsuru (PaaS)Database as a service
BLUE-GREEN DEPLOY
https://github.com/rafaelbiriba/cap_blue_green_deploy
Setup do ambiente local muito mais simplesGarante um ambiente igual para qualquer máquinaIsolamento de containers
docker run --name redis -d redisdocker run --name mongodb -d mongo:2.4 mongoddocker run --name globosatplay -p 3010:3010 -v "$(pwd)":/app \ --link mongodb:mongodb --link redis:redis globosatplay
https://tsuru.io/
PaaS open source da Globo.com
Mais liberdade para os desenvolvedoresDeploys mais rápidos e frequentesEscalabilidade de forma simples
tsuru app-create myappgit remote add tsuru [email protected]:myapp.gitgit push tsuru master
DATABASE AS A SERVICEhttps://github.com/globocom/database-as-a-service
MONOLITO X MICRO SERVIÇOS
ARQUITETURA MONOLÍTICA
Arquitetura mais simplesSetup local mais fácilAtualizações mais rápidas (gems, bugfixes)Mais fácil de testarAmbiente homogêneoMenos pontos de falha
MICRO SERVIÇOS
Projetos menores e mais fáceis de gerenciarBuild mais rápidoDeploys menores e menos arriscadosInfra mais flexívelPermite mudanças incrementais
QUAL A MELHOR ARQUITETURA?
DEPENDE!
REFERÊNCIAS
REFERÊNCIAShttp://philcalcado.com/2015/09/08/how_we_ended_up_with_microservices.htmlhttp://labs.spotify.com/2014/03/27/spotify-engineering-culture-part-1/https://sudo.hailoapp.com/web/2014/12/08/webapps-as-microservices/http://www.ustream.tv/recorded/61479577http://qconsp.com/sp2015/system/files/presentation-slides/QConSP2015-MonolithToMicroServices.pdf
OBRIGADO!http://blog.guilhermegarnier.com
@guilhermgarnier
Slides: http://blog.guilhermegarnier.com/evolucao-arquitetura/