2021 summary of the latest Java common open source libraries, Java interview handwritten code

Programmer Xiao Gang 2021-10-14 07:22:16
summary latest java common open


2. ZooKeeper Introduce

2.1. ZooKeeper origin

Formal introduction ZooKeeper Before , Let's take a look first ZooKeeper The origin of , It's interesting .

Here's an excerpt from 《 from Paxos To ZooKeeper 》 Chapter four, section one , I recommend you to read :

ZooKeeper It originated from a research group of Yahoo Research Institute . At the time , The researchers found that , Many large systems in Yahoo need to rely on a similar system for distributed coordination , But these systems often have distributed single point problems . therefore , Yahoo developers are trying to develop a general distributed coordination framework without single point problems , So that developers can focus on the business logic .

About “ZooKeeper” The name of the project , In fact, there is an interesting story . At the beginning of the project , Considering that many internal projects are named after animals before ( For example, famous Pig project ), Yahoo engineers want to give the project the name of an animal . The chief scientist of the Institute at that time RaghuRamakrishnan Jokingly say :“ Go on like this , We have become a zoo here !” There is a , We all said that we would call zookeepers one after another because the distributed components named after animals are put together , Yahoo's entire distributed system looks like a large zoo , and ZooKeeper It's just going to be used to coordinate the distributed environment ,ZooKeeper That's why the name of .

2.2. ZooKeeper overview

ZooKeeper It's an open source Distributed coordination services , Its design goal is to encapsulate the complex and error prone distributed consistency services , Form an efficient and reliable set of primitives , And a series of simple and easy-to-use interfaces are provided for users to use .

The original language : Operating systems or computer networks . Is composed of several instructions , A process used to accomplish a certain function . It is indivisible · That is, the execution of the primitive must be continuous , No interruption is allowed during execution .

ZooKeeper Provides us with high availability 、 High performance 、 Stable distributed data consistency solution , It's often used to implement things like data publishing / subscribe 、 Load balancing 、 Naming service 、 Distributed coordination / notice 、 Cluster management 、Master The election 、 Distributed lock and distributed queue .

in addition ,ZooKeeper Save data in memory , The performance is excellent . stay “ read ” More than “ Write ” Especially high performance in applications , because “ Write ” Will cause all servers to synchronize state .(“ read ” More than “ Write ” It's a typical scenario for coordinating services ).

2.3. ZooKeeper characteristic

  • Sequential consistency : Transaction requests initiated from the same client , It will eventually be applied strictly in order to ZooKeeper In the middle .
  • Atomicity : The processing results of all transaction requests are consistent across all machines in the cluster , in other words , Or all machines in the whole cluster have successfully applied a certain transaction , Or there's no application .
  • Single system image : No matter which client is connected to ZooKeeper Server , The server data model it sees is consistent .
  • reliability : Once a change request is applied , The result of the change will be persisted , Until overridden by the next change .

2.4. ZooKeeper Typical application scenarios

ZooKeeper In the Overview , We've introduced how to use it to implement data publishing / subscribe 、 Load balancing 、 Naming service 、 Distributed coordination / notice 、 Cluster management 、Master The election 、 Distributed lock and distributed queue .

Select below 3 A typical application scenario to talk about :

  1. Distributed lock : Get distributed locks by creating unique nodes , The lock is released when the party who obtains the lock executes the relevant code or hangs up .
  2. Naming service : Can pass ZooKeeper The order nodes of the order are generated globally unique ID
  3. Data Publishing / subscribe : adopt Watcher Mechanism It is very convenient to realize data publishing / subscribe . When you publish data to ZooKeeper On the monitored node , Other machines can monitor ZooKeeper The dynamic update of the configuration is realized by changing the nodes on the .

actually , The realization of these functions basically benefits from ZooKeeper The function of saving data , however ZooKeeper Not suitable for holding large amounts of data , This needs attention .

2.5. What famous open source projects have been used ZooKeeper?

  1. Kafka : ZooKeeper Mainly for Kafka Provide Broker and Topic Registration and multiple Partition Load balancing and other functions of .
  2. Hbase : ZooKeeper by Hbase Provide to ensure that there is only one Master And preserving and providing regionserver State information ( Whether online ) And so on .
  3. Hadoop : ZooKeeper by Namenode Provide high availability support .

3. ZooKeeper Interpretation of important concepts

alternative pronunciations : Take out the small book , The following is very important !

3.1. Data model( Data model )

ZooKeeper The data model adopts hierarchical multi branch tree structure , Data can be stored on each node , These data can be numbers 、 String or binary sequence . also . Each node can also have N Child node , The top layer is the root node with “/” To represent the . Each data node is in ZooKeeper Known as znode, It is ZooKeeper The smallest unit of data in . also , Every znode A unique path identifier .

Emphasize one sentence :ZooKeeper It's mainly used to coordinate services , It's not used to store business data , So don't put big data in znode On ,ZooKeeper The upper limit given is that the maximum data size of each node is 1M.

It can be seen more intuitively from the figure below :ZooKeeper Node path identification method and Unix File system paths are very similar , It's all made up of a series of slashes "/" Split path representation , Developers can write human data to this node , You can also create child nodes under the nodes . We will introduce these operations later .

2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _ The backend development

3.2. znode( Data nodes )

It introduces ZooKeeper After the tree data model , We know that every data node is in ZooKeeper Known as znode, It is ZooKeeper The smallest unit of data in . The data you want to store is on it , You use ZooKeeper A concept that you often need to touch in the process .

3.2.1. znode 4 Types

We usually will znode It is divided into 4 Categories: :

  • persistent (PERSISTENT) node : Once created, it's always there, even if ZooKeeper Cluster down , Until you delete it .
  • temporary (EPHEMERAL) node : The lifetime of a temporary node is related to Client session (session) The binding of , If the session disappears, the node disappears . also , Temporary nodes can only be leaf nodes , Cannot create child nodes .
  • Persistent order (PERSISTENT_SEQUENTIAL) node : In addition to having lasting (PERSISTENT) Besides the characteristics of nodes , The names of child nodes are also sequential . such as /node1/app0000000001/node1/app0000000002 .
  • Provisional order (EPHEMERAL_SEQUENTIAL) node : Besides having temporary (EPHEMERAL) Besides the characteristics of nodes , The names of child nodes are also sequential .

3.2.2. znode data structure

Every znode from 2 Part of it is made up of :

  • stat : State information
  • data : The specific content of the data stored by the node

Last

The author has sorted the interview questions and answers into interview special documents

2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _ The programmer _02

?2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _ The programmer _03

2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _ The backend development _04

?2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _ The programmer _05

2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _Java_06

?2021 newest Java Summary of common open source libraries ,Java Interview handwritten code _Java_07

This article has been  CODING Open source project :【 A big factory Java Analysis of interview questions + Core summary learning notes + The latest explanation video + Actual project source code 】 Included

版权声明
本文为[Programmer Xiao Gang]所创,转载请带上原文链接,感谢
https://javamana.com/2021/10/20211002151515601a.html

  1. Day17 Java Foundation
  2. Day18 Java Foundation
  3. Linux installe JDK 1.8 et configure les variables d'environnement
  4. Tutoriel d'utilisation Maven super détaillé
  5. Spring boot reads project parameter configuration
  6. Docker installing rocketmq
  7. Java Zero Basic small white Beginner must make a summary of issues (recommended Collection) Chapitre 1
  8. Manuel pour vous apprendre à utiliser le développement Java pour générer des documents PDF en ligne
  9. 40 + comment les femmes s'habillent - elles pour montrer leur jeunesse?Un manteau et une jupe vous donnent un look haut de gamme tout au long de l'automne et de l'hiver
  10. Tutoriel d'installation Ubuntu 16.04 / Hadoop 3.1.3Configuration autonome / pseudo - distribuée
  11. L'apprentissage le plus détaillé de springboot à l'échelle du réseau - day01
  12. L'apprentissage le plus détaillé de springboot sur le Web - day02
  13. L'apprentissage le plus détaillé de springboot sur le Web - day03
  14. L'apprentissage le plus détaillé de springboot sur le Web - day04
  15. Tutoriel d'utilisation Maven super détaillé
  16. L'apprentissage le plus détaillé de springboot sur le Web - day05
  17. L'apprentissage le plus détaillé de springboot sur le Web - day06
  18. L'apprentissage le plus détaillé de springboot sur le Web - day07
  19. Introduction to JavaScript - write a photo album for your girlfriend
  20. [Hadoop 3. X] HDFS storage type and storage strategy (V) overview
  21. L'apprentissage le plus détaillé de springboot sur le Web - day08
  22. Introduction à la page Web de rabbitmq (3)
  23. No Converter found for return value of type: class java.util.arraylist Error Problem
  24. (16) , spring cloud stream message driven
  25. Que faut - il apprendre de l'architecture des microservices Spring Cloud?
  26. Résolution: erreur: Java: distribution cible invalide: 11problème d'erreur
  27. Springboot démarre en une minute et sort de l'enfer de la configuration SSM!
  28. Maven - un outil de gestion essentiel pour les grands projets d'usine, de l'introduction à la maîtrise![️ Collection recommandée]
  29. ️ Push to interview in Large Factory ᥧ - - Spring Boot Automatic Assembly Principle
  30. [️ springboot Template Engine] - thymeleaf
  31. Springboot - MVC Automatic configuration Principle
  32. Mybatis reverse engineering and the use of new version mybatisplus 3.4 reverse engineering
  33. Base de données MySQL - transactions et index
  34. Sécurité du printemps - [authentification, autorisation, déconnexion et contrôle des droits]
  35. Moteur de base de données InnoDB diffère de myisam
  36. Swagger - [springboot Integrated Swagger, configure Swagger, configure scan Interface, configure API Group]
  37. Cadre de sécurité Shiro - [QUICKstart, login Block, User Authentication, request Authorization]
  38. [Introduction à Java] installation de l'environnement de développement - Introduction à Java et construction de l'environnement
  39. 【 linux】 notes d'utilisation tmux
  40. MySQL + mybatis paging query - database series learning notes
  41. Usage relations and differences of count (1), count (*) and count (a field) in MySQL
  42. 2021 Ali Java advanced interview questions sharing, Java Architect interview materials
  43. Mybatis - dynamic SQL statement - if usage - MySQL series learning notes
  44. [go to Dachang series] deeply understand the use of where 1 = 1 in MySQL
  45. [secret room escape game theme ranking list] Based on spring MVC + Spring + mybatis
  46. Redis log: the killer mace of fearless downtime and rapid recovery
  47. 5 minutes to build redis cluster mode and sentinel mode with docker
  48. Java小白入门200例106之遍历ArrayList的几种方式
  49. Java小白入门200例105之Java ArrayList类
  50. Java小白入门200例104之JDK自带记录日志类logging
  51. Practice of high availability architecture of Tongcheng travel network based on rocketmq
  52. Chapter 9 - Linux learning will - file archiving and compression tar --- zip
  53. Java小白入門200例104之JDK自帶記錄日志類logging
  54. JDK avec journalisation de classe dans 200 cas 104
  55. Java ArrayList Class for Introduction to Java LITTLE WHITE 200 example 105
  56. Plusieurs façons de traverser ArrayList à partir de 200 exemples 106
  57. Provectus / Kafka UI: open source Apache Kafka's Web GUI Graphical interface management tool
  58. Design pattern series: Singleton pattern
  59. Java小白入門200例105之Java ArrayList類
  60. Understanding Java record types