Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDC SP 2018 - Trilha Java - Computação Paralela

TDC SP 2018 - Trilha Java - Computação Paralela

Em todos os projetos se fala de escalabilidade, e muitas as vezes a responsabilidade é deixada para o time de infraestrutura, contudo, mais máquinas nem sempre é a solução. Entenda quais os mecanismos que podem ser utilizados no seu software, saiba quando usar cada técnica!

Leonardo

July 21, 2018
Tweet

More Decks by Leonardo

Other Decks in Programming

Transcript

  1. Globalcode – Open4education Evolution of CPUs https://en.wikipedia.org/wiki/Moore's_law “The number of

    transistors doubles approximately every two years.” – Goordon Moore
  2. Globalcode – Open4education In 2000… Intel predicted 10 GHz chips

    on desktop by 2011 https://www.zdnet.com/article/taking-chips-to-10ghz-and-beyond-5000096055/
  3. Globalcode – Open4education Concurrent and Parallel Do something else while

    waiting for… Split a problem into smaller chunks and solve together…
  4. Globalcode – Open4education So… What do we have? “If you

    want to exploit multiple cores with threads and locks, your only choice is to create a concurrent program and then run it on parallel hardware…” – Paul Butcher Globalcode – Open4education So… What do we have? “If you want to exploit multiple cores with threads and locks, your only choice is to create a concurrent program and then run it on parallel hardware…” – Paul Butcher
  5. Globalcode – Open4education Use cases… BigData Statistical Applications Crawler Scheduled

    Tasks Batch Processing Front-end Games Android Non-business Operations Logging Monitoring
  6. Globalcode – Open4education Concurrent API – Java 5 [2004] Atomic

    Explicit Locks Synchronizers Latches Semaphore Barrier Future Executor ThreadPool Doug Lea, professor at State University of New York
  7. Globalcode – Open4education Concurrent API – Java 7 [2011] Phaser

    ForkJoinPool RecursiveAction and RecursiveTask
  8. Globalcode – Open4education Concurrent API – Java 9 [2017] Flow

    API http://javasampleapproach.com/java/java-9-flow-submissionpublisher-concrete-publisher Publish-Subscribe Pattern with Flow Control Single basic (helper) implementation available in JDK: SubmissionPublisher
  9. Globalcode – Open4education Reactive Streams The purpose of Reactive Streams

    (.ORG) is to provide a standard for asynchronous stream processing with non- blocking backpressure Reactive Systems: – process a potentially unbounded number of elements – in sequence, – asynchronously passing elements between components, – with mandatory non-blocking back-pressure. http://www.reactive-streams.org/
  10. Globalcode – Open4education Go further Java EE Concurrency Utilities Keyword

    volatile Class sun.misc.Unsafe Concurrency Random Numbers Java Memory Model Blocking Queues OpenJDK – Project Loom Thread Leak Fibers MapReduce Lock Contention CSP – Communication Sequential Processes Antipattern Double-checked-locking STM – Software Transactional Memory Pattern LMAX / Disruptor Parallel Universe - Quasar