O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Ignorance of CAP Is Not an Excuse

444 visualizações

Publicada em

This presentation by Maksym Voroniy (Consultant, Engineering, Kharkiv) was delivered at GlobalLogic Kharkiv Java Conference 2019 on June 9, 2019.

Maksym shed light on obscure corners of distributed systems so that the audience clearly understood how the majority of well-known market products really function.

Video: https://youtu.be/2Y7PDogSF4I

Publicada em: Tecnologia
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Ignorance of CAP Is Not an Excuse

  1. 1. IGNORANCE OF CAP IS NOT AN EXCUSE why I ever should care about theory?
  2. 2. PREAMBLE Complicated business domain Simple example (book storage that is CP) Review of tool usage (Distributed lock pattern) How to use it in real project
  3. 3. MOTIVATION
  4. 4. CAP (IN BRIEF) Availability PartitioningConsistency In distributed systems it is impossible to implement atomic read/write operation that guarantees response to every request In the presence of a network partition, one has to choose between consistency and availability.
  5. 5. AC EXAMPLE from https://www.baltikon.lv/special/konsultant-buhgalter-flesh-versiya-va/ • classical RDBMS databases • no concurrency • no ability to scale
  6. 6. DID YOU JUST SAY “SCALE”? Scalability is the property of a system to handle a growing amount of work by adding resources to the system (by Wiki)
  7. 7. AP EXAMPLE AWS Cloud Availability Zone 1 Auto Scaling group Availability Zone 2 Auto Scaling group Instance Instance Instance Instance Amazon EC2 Auto Scaling private void handleInfiniteStream(InputStream is){ try { var data = is.read(); // process data here } catch (IOException e) { log.error(e); } } public void infiniteConsume(String connectionParam){ while (true) { try (Connection conn = new Connection()) { try(InputStream is = conn.inputStream()){ handleInfiniteStream(is); } } catch (IOException e) { log.error(e); //retry connection } } }
  8. 8. CP EXAMPLE Master Slave db.products.insert( { item: "envelopes", qty : 100, type: "Clasp" }, { writeConcern: { w: "majority" , wtimeout: 5000 } } ) from https://docs.mongodb.com/manual/core/replica-set-write-concern/
  9. 9. CAP IS NEGATIVE WE CAN USE IT • Business driven solutions • Relaxed requirements
  10. 10. IMROOVE “C” IN AP (KAFKA) https://channel9.msdn.com/Shows/Azure-Friday/Introducing-Apache-Kafka-on-Azure-HDInsight https://bravenewgeek.com/tag/leader-election/ ZooKeeper allows implement leader election algorithm by short time blocking ISR = in-sync replicas
  11. 11. IMPROVE “A” FOR CP Eventually (relaxed) consistence Partitioning still works (master-master schema): odd even {id:1, name:’A’}, {id:2, name:’B’} Use precise locking • one lock per pack file. • ... • one lock for each reference name. • one lock for the index.
  12. 12. CONCLUSION • CAP is everywhere • CAP is negative so find your way out • Speak with business if some requirements may be relaxed Thank you! maksym.voroniy@globallogic.com

×