Trilha HPC TDC 2015: Mostramos quais são as principais vantagens e desvantagens da programação reativa. Atualmente existem algumas perguntas que ainda de fato não temos respostas: Será que nossos sistemas já estão no limite? Será que ainda há espaço a ser conquistado e ganhos de performance a se descobrir?
5. INTERNET USERS
2.4bi
2012
INTERNET USERS
3.01bi
TENS OF SERVERS
Fontes: http://recode.net/2014/05/28/meeker-as-internet-user-growth-slows-the-real-driver-is-mobile-usage/
http://www.slideshare.net/wearesocialsg/digital-social-mobile-in-2015
RESPONSE TIME
SECONDS
CLOUD-BASED CLUSTER
MULTICORE
OFFLINE
MAINTENANCE
REAL TIME
MILLISEC/MICROSEC
100%
UPTIME
FAST DATA
GIBABYTE DATA
BIGDATA
PETABYTES
2015
6. As exigências e as expectativas
para aplicações mudaram
drasticamente nos últimos anos.
7. Precisamos de sistemas que irão:
● Reagir a eventos (Event-Driven)
● Reagir a carga (Scalable)
● Reagir a falhas (Resilient)
● Reagir a usuários (Responsive)
10. O que são sistemas Reativos?
Sistemas criados como Reativos são muito mais
flexíveis, desacoplados e escaláveis. Isso os torna
mais fáceis de desenvolver e manter. São mais
tolerantes a falhas e quando elas ocorrem são
tratadas com elegância ao invés de desastre.
Sistemas Reativos são responsivos, dando aos
usuários feedbacks mais interativos.
Fonte: http://www.reactivemanifesto.org/pt-BR
13. Share Mutable State
● with threads:
○ code that is totally non-deterministic;
○ the root of all evil;
● Avoid it at all cost;
● Use immutability;
14. Never/Avoid Block
● Unless you really have to;
● Blocking kills scalability (+ performance);
● Use non-blocking IO;
● Use lock-free concurrency;
15. Async
● Use asynchronous event/message passing;
● Lower latency (vs sales);
● Better throughput;
● A more loosely coupled architecture, easier
to extend, evolve and maintain.
16. Some t ls
● Actors
● Agents
● Future/Dataflow
● Reactive Extensions (Rx)
17. Actors
● Isolated lightweight event-based processes;
● Each actor has a mailbox (message queue);
● Communicates through asynchronous and
non-blocking message passing;
● Location transparent (distributable);
● Supervision-based failure management;
18. Agents
● Reactive memory cells;
● Send a update function to the Agent;
● Reads are “free”, just dereferences
the Ref;
● Composes nicely;
19. Futures/Dataflow
● Allows you to spawn concurrent
computations and work with the not yet
computed results;
● Freely sharable;
● Allows non-blocking composition;
● Build in model for managing failure;
20. Reactive Extensions (Rx)
● Extend Futures with the concept of a
Stream;
● Composable in a type-safe way;
● Event-based & asynchronous;
● Observable ⇛ Push Collections;