Tuesday, July 14, 2026
HomeBig DataApache Kafka Deployments and Techniques Reliability - Half 1

Apache Kafka Deployments and Techniques Reliability – Half 1

[ad_1]

There are various ways in which Apache Kafka has been deployed within the discipline. In our Kafka Summit 2021 presentation, we took a short overview of many alternative configurations which were noticed up to now. On this weblog collection, we are going to talk about every of those deployments and the deployment decisions made together with how they influence reliability. In Half 1, the dialogue is expounded to: Serial and Parallel Techniques Reliability as an idea, Kafka Clusters with and with out Co-Positioned Apache Zookeeper, and Kafka Clusters deployed on VMs. 

Serial and Parallel Techniques Reliability 

Techniques Reliability could be regarded as how lengthy a system can function accurately earlier than it enters a foul state with out the necessity for upkeep or outsider actions to resolve issues with the system itself. This reliability could be seen as two sorts: Serial Reliability and Parallel Reliability. Kafka clusters expertise a combination of each of some of these reliability and whereas past the scope of this collection to calculate and blend each collectively we are going to reference and talk about a few of issues in every deployment kind that may influence the Serial and Parallel Reliability of the deployment topology itself. There are additionally differing layers you possibly can carry out this evaluation on to attempt to resolve how dependable components of a system are. From very low ranges, you possibly can have a look at how the {hardware} itself is deployed, going increased you possibly can have a look at the cluster deployment and past that you would be able to get into programs which have cluster redundancy akin to system catastrophe restoration and are available to completely different conclusions concerning the reliability at every layer. 

Serial Techniques Reliability

With a Serial System, reliability depends upon each element within the system to proceed working. The failure of a single element will consequence within the system changing into unavailable. There are various issues like this that individuals expertise in every day life that fall into the serial system bucket, maybe one of the crucial pervasive is an car. If the battery in your car stops functioning, you’re not in a position to begin and make the most of the automobile (system) till that element is repaired. The automobile additionally has different parts that function on this vogue such because the gasoline pump, ECU, and even the tires. Whereas there are 4 tires, all 4 are required to function the automobile, its efficiency is considerably degraded when working with out all 4 tires to the purpose it possible shouldn’t be utilized wanting harming parts on the system just like the wheel hubs extra. 

Kafka as software program falls extra cleanly into the Parallel Techniques Reliability mentioned under however some components of it could actually find yourself Serial. Particularly {hardware} infrastructure in my expertise has a better probability of serial primarily based failures. For instance working an OS disk on the server which isn’t in a RAID configuration that gives redundancy will lead to a serial reliability calculation for the disk which the Kafka Dealer can be depending on for operation. Servers with only one community drop relay on the networking card, cable, and swap to proceed working and all current a serial reliability subject if not deployed in a Extremely Accessible redundant vogue.

Mathematically a Serial System Reliability could be described as the next, the place including extra parts will proceed to weaken the system. 

Rs= R1* R2… Rn

RS is the Reliability of the entire system

R1, R2, Rn… is the reliability of every element within the system 1 being the primary, 2 being the second and n being nonetheless many n parts there are.  

For instance a serial system with 90% dependable parts 

  • 2 parts
    •  90% * 90% = 81% system reliability  
  • 4 parts
    •  90% * 90% * 90% * 90% = 65% system reliability

Parallel Techniques Reliability

With a Parallel System, Reliability on having one element on-line leads to the system remaining on-line, some might equate this with redundancy or excessive availability. With Kafka, this is a little more advanced than simply having further brokers that are parallely accessible. There are a number of facets to the software program reliability of the subject being hosted: replicas, and minimal in-sync replicas. Whereas not an ideal instance of Parallel Techniques, one acquainted to most can be our personal eyes and ears which offer redundant performance. Ought to an ear or eye cease working you possibly can proceed to see and listen to, the explanation I really feel it is a poor instance is that the efficiency of your sight and listening to are lowered despite the fact that persevering with to operate. 

Mathematically Parallel System Reliability could be described as the next, the place including extra parts will proceed to strengthen the system. 

Rs= 1 - (1 -R1) *(1-R2) … (1-Rn)

For instance a parallel system with 90% dependable parts

  • 2 parts
    • 1-(1-0.90)*(1-0.90) = 99.00% system reliability  
  • 4 parts 
    • 1-(1-0.90)*(1-0.90)*(1-0.90)*(1-0.90) = 99.99% system reliability  

When occupied with parallel reliability inside Kafka, as aforementioned, it has rather a lot to do with the subject replicas, producer acks and in-sync replicas. This configurability brings Kafka numerous tunability the place different programs like Zookeeper have a hard and fast configuration that can not be modified. 

A subject with any variety of partitions however only one duplicate has no parallel copies of the information accessible, within the occasion that one duplicate is misplaced on account of a dealer failure that the whole partition is offline for the subject making it unable to just accept reads or writes. Ought to the subject using better than 1 duplicate it then has parallel copies of itself that are in a position to stand up to the failure of a dealer preserving the information on-line for reads and probably writes. 

Producer acknowledgements (acks) is a method that message sturdiness is managed with subject writes. There are 3 methods a producer could be configured to acknowledge {that a} messages have been written to the dealer: acks=0 which is a fireplace and neglect with out ready for a dealer to ack and the least sturdy offering no assure, acks=1 which waits for the write to the chief duplicate on a dealer to be acknowledged, and acks=all which is probably the most sturdy and writes to a minimal variety of in-sync replicas for the given partition.

Writes when utilizing a producer with acks=all depends upon the minimal in-sync replicas that are replicas primarily based on configurations (min-insync.replicas & duplicate.lag.time.max.ms) thought-about to be present (and non-lagging) copies of the chief duplicate. The min-insync.duplicate configuration then helps present message sturdiness ensures by permitting or disallowing writes ought to the cluster be taken right into a degraded state; akin to not having sufficient replicas on-line on account of dealer or hard-drive failures to satisfy the min necessities or ought to it begin replicating slowly for some motive past the time set by duplicate.lag.time.max.ms. You could have realized that the min-insync.duplicate doesn’t present system availability and feels as if it really works towards preserving the system on-line however that is the tradeoff made to be able to have sturdy messages (forestall message loss within the system) there isn’t a free lunch as they are saying. After all must you not care about sturdiness of messages (acceptable to lose messages) one can all the time allow unclean.chief.election.allow=true at a cluster or subject degree, with this setting even when all in-sync replicas are misplaced the subject will proceed to function and settle for writes. 

In a system using unclean.chief.election.allow=true and replicas are lower than or equal to the variety of brokers within the cluster then the variety of parts within the parallel system reliability components could be regarded as the variety of replicas. When viewing the system as an entire this is probably not precisely appropriate as a result of there could possibly be a number of serial parts under-pinning the cluster such because the community core or working system exhausting drives for the server which will scale back the reliability of the subject however from a cluster perspective the subject could be regarded as having the given parallel reliability. 

Kafka Clusters with and with out Co-Positioned Zookeeper

One of many present dependencies that working a Kafka cluster has is on having a Zookeeper quorum, and whereas the neighborhood is engaged on a KRaft implementation that can be capable of change Zookeeper on the time of scripting this it’s unavailable outdoors of an early entry kind that will not be beneficial for manufacturing. The way you deploy Zookeeper can matter significantly to the reliability of your Kafka Cluster the under diagram reveals quite a lot of methods smaller 3 node Kafka Clusters have been deployed, these should not the one doable permutations however a few of the commonest seen.

In Model 1, I think about this probably the most Serial deployment doable when deploying a 3 node Kafka cluster. The first causes for this are: Positioned in a single rack, Kafka and Zookeeper are co-deployed, there could possibly be different causes as properly associated to the highest of rack swap if it’s redundant or not and if the community core is redundant or not.  The Kafka cluster itself remains to be argubally a parallel system. These components actually begin to contact on what a part of the system you’re looking at as mentioned in part Serial and Parallel Techniques Reliability above, that the {hardware} could also be serial however the software program on prime could possibly be parallel. 

Whereas there’s nothing particularly fallacious with this deployment, if trying to maximise the parallel system for reliability and reduce serial results one ought to be aiming to scale back any single serial failure paths. The colocated Zookeeper and Kafka brokers add an extra complexity in {that a} single server failure can have a bigger influence then if a single server failed like in Model 2 have been Zookeeper and Kafka Dealer are separate. It is because Zookeeper and Kafka are each impartial parallel programs however now each probably linked to the identical serial failure occasion on the {hardware} degree. 

If you happen to do resolve to colocate each Zookeeper and Kafka collectively on the identical server make sure that Zookeeper log listing is using devoted disks which aren’t shared with another purposes akin to Kafka log listing. It is because Zookeeper operates by committing each transaction to disk earlier than it’s accessible within the Zookeeper Quorum. If the disk is being shared with one other utility like Kafka that can also be utilizing the disk it’s doable to create massive delays in transactions being dedicated that may decelerate processes that require the up to date information from the Zookeeper Quorum. One other potential pitfall of not having devoted disks for Kafka and Zookeeper is that if the Kafka subject will not be configured to have a bytes retention coverage and solely retains primarily based on time ought to the disk refill on account of uncontrolled producer writes Zookeeper will not be capable of commit ceasing to operate on account of lack of accessible storage.  

Personally I’ve run model 3 in manufacturing for quite a lot of years with acceptable outcomes. On this deployment the serial rack failure is mitigated by spreading out the brokers and Zookeepers servers throughout a number of racks. This may help scale back the influence when you’re not utilizing a redundant community swap in your prime of rack swap.   For the time that this configuration was run we did have Zookeeper colocated with our Kafka Brokers however as famous above utilized devoted disks and by no means noticed any points associated to Zookeeper disk rivalry.  In case you have the {hardware} accessible you need to nonetheless separate your Zookeeper and Kafka brokers to proceed bettering the reliability of the system to failures by lowering the serial dependencies on a single server. 

VM Based mostly Kafka Clusters

One other deployment sample some shoppers use is to deploy the Kafka Cluster over Digital Machines (VMs.) This may create some further complexities not solely on the {hardware} degree however on the software program degree too. It goes with out saying that a number of VMs could possibly be positioned into the identical bodily rack very like within the prior part Kafka Clusters with and with out Co-Positioned Zookeeper so we gained’t drill into these as they’ve been mentioned already, fairly the problems which might be necessary to deal with listed here are: a number of brokers per bodily VM Host, and partition duplicate placement.  

The above diagram supplies an instance of how a 3 node cluster could possibly be deployed on 2 VM Hosts. On this case VM Host 1 has a number of Kafka Brokers positioned on it: VM1 and VM3. Whereas this will not trigger any particular points it does current a serial reliability dependency on the VM Host 1, if it’s misplaced or experiences a efficiency degeneration for any motive all associated VMs also can expertise this subject. This may create a way more advanced debugging state of affairs the place it could actually take further time to debug if it’s the software program or the virtualization resolution and its underlying {hardware} that’s creating the difficulty. Personally I’ve seen groups spend hours making an attempt to debug their Kafka Cluster believing one thing was fallacious with the software program when it turned out it was the underlying VM Host that was experiencing the problem, after many hours they moved the VM’s off the host and the issues resolved; later it was recognized {that a} CPU {hardware} subject was ongoing with that particular VM Host. 

One other subject that’s offered right here is expounded to the serial reliability of the duplicate placement for every subject’s partitions. Given a scenario the place a subject has a reproduction of two each replicas might find yourself being hosted on the identical VM Host, on this case if the VM host is misplaced then the partition would grow to be unavailable.  For probably the most half this subject could be prevented by using Rack Consciousness in Kafka however requires the cluster administrator to grasp which Rack every VM Dealer is positioned in in order that the suitable mapping could be assigned to every Dealer. If all of the VM Hosts are positioned in the identical bodily rack then a VM Host degree mapping must be applied to make sure that every VM Host is handled as if it was a rack bodily. Doing this may then take away the serial reliability {that a} duplicate has on the one VM Host and start treating it as extra parallel reliability from a {hardware} and software program perspective. 

In Abstract

On this a part of the collection, we set the stage for Serial and Parallel Reliability as an idea, how there are a number of ranges that may be checked out from the {hardware}, software program, and the parallel system itself which might change how one thinks about reliability. We additionally appeared into a number of ways in which Single Clusters have been deployed traditionally with and with out colocated Zookeeper, and inside a single rack or throughout a number of. Lastly, we shared a dialogue on Virtualized clusters and the complexities that exist from dependencies on a single digital host working many VMs and duplicate placement complexities. These deployments largely contact on the {hardware}, software program and the way the parallel system operates for a single deployment. Partly 2 of the collection, we are going to have a look at failover between clusters and geographically deployed programs which have to copy information between them offering a degree of System or Cluster redundancy.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments