Skip to main content

Apache NiFi Load Balancing via Load Balanced Connections

Modern Apache NiFi Load Balancing

In today's Apache NiFi, there is a new and improved means of load balancing data between nodes in your cluster.   With the introduction of NiFi 1.8.0, connection load balancing has been added between every processor in any connection.    You now have an easy to set option for automatically load balancing between your nodes.  The legacy days of using Remote Process
Groups to distribute load between Apache NiFi nodes is over. For maximum flexibility,
performance and ease, please make sure you upgrade your existing flows to
use the built-in Connection Load Balancing.

If you are running newer Apache NiFI or Cloudera Flow Management (CFM), you have had a
better way of distributing processing between processors and servers.   This is for
Apache NiFi 1.8.0 and higher including the newest version 1.9.2.

Note:  Remote Process Groups are no longer necessary for load balancing!
Use actual load balanced connections instead!

Remote Process Groups should only be used for distributing to other clusters.

Apache NiFi Load Balancing 

Since 2018, it's been an awesome feature:

We have a few options for Load Balancing Options, these strategies include
"Round Robin" that during failure conditions data will be rebalanced to
another node.   This can rebalance thousands of flow files per second or
more depending on flow file size.   This is done to give a node a chance to
reconnect and continue processing.

Data Distribution Strategies

Other option is to “Partition by Attribute” and “Single Node”  which will
queue up data until that single node or partitioned node returns.   You
cannot pick which Node in the cluster does that processing for portability
purposes.   We need to be dynamic and elastic, so it just needs to be one
node. This allows for “like data” can be sent to the same node in cluster
which may be necessary for certain use cases.      Using a custom
Attribute Name for this routing can be powerful as well as for Merges
in table loading use cases.  We can also choose to not load balance at all.   

Elastic Scaling for Apache NiFi

An important new feature that was added to NiFi is to allow nodes to be
decommissioned and disconnected from the cluster and all of their data
offloaded.   This is important for Kubernetes and dynamic scaling for
elasticity. Elastic Scaling is important for workloads that differ during
the day or year like once an hour loads or weekly jobs.   Scale up to
meet SLAs and deadlines, but scale down when possible to save cloud
spend! Now NiFi not only solves data problems but saves you cash

Apache NiFi Node Affinity

Remote Process Groups do not support node affinity.    Node affinity is
supported in our Partition by Attribute strategy and has many uses.

Remote Process Groups

To replace the former big use case, we used Remote Process Groups.  
We have a better solution, for a first connection like ListSFTP runs on
one node and the connections can then be "Round Robin".

Important Use Case

This load balancing feature of Apache NiFi shows the power of distributing a large dataset
or unstructured data capture at the edge or other datacenter, split and transfer, then use
attribute affinity to a node to reconstitute the data in a particular order.  
So what happens is sometimes you have a large bulk data export from a system like a
relational database dump in one multiple terabyte file.   We need one NiFi node to load
this file and then split it up into chunks, transfer it and send it to nodes to process. Sometimes
ordering of records will require we use an attribute to keep related chunks (say the same Table) together on one node.

We also see this with a large zip file containing many files of many types. Often there will
be hundreds of files of the multiple types and we may want to route to the same
node based on filename root. That way one NiFi node will be processing all the same file types or
table.   This is now trivial to implement and easy for any NiFi user to examine and see what is
going on in this ETL process.


    Popular posts from this blog

    Migrating Apache Flume Flows to Apache NiFi: Kafka Source to HDFS / Kudu / File / Hive

    Migrating Apache Flume Flows to Apache NiFi: Kafka Source to HDFS / Kudu / File / HiveArticle 7 - Article 6 -
    Article 5 - 
    Article 4 - Article 3 - Article 2 - Article 1 Source Code:
    This is one possible simple, fast replacement for "Flafka".

    Consume / Publish Kafka And Store to Files, HDFS, Hive 3.1, Kudu

    Consume Kafka Flow 

     Merge Records And Store As AVRO or ORC
    Consume Kafka, Update Records via Machine Learning Models In CDSW And Store to Kudu


    Exploring Apache NiFi 1.10: Stateless Engine and Parameters

    Exploring Apache NiFi 1.10:   Stateless Engine and Parameters Apache NiFi is now available in 1.10!

    You can now use JDK 8 or JDK 11!   I am running in JDK 11, seems a bit faster.

    A huge feature is the addition of Parameters!   And you can use these to pass parameters to Apache NiFi Stateless!

    A few lesser Processors have been moved from the main download, see here for migration hints:

    Release Notes:

    Example Source Code:

    More New Features:

    ParquetReader/Writer (See: Reporting Task.   Expect more Prometheus stuff coming.Experimental Encrypted content repository.   People asked me for this one before.Par…

    Ingesting Drone Data From DJII Ryze Tello Drones Part 1 - Setup and Practice

    Ingesting Drone Data From DJII Ryze Tello Drones Part 1 - Setup and Practice In Part 1, we will setup our drone, our communication environment, capture the data and do initial analysis. We will eventually grab live video stream for object detection, real-time flight control and real-time data ingest of photos, videos and sensor readings. We will have Apache NiFi react to live situations facing the drone and have it issue flight commands via UDP. In this initial section, we will control the drone with Python which can be triggered by NiFi. Apache NiFi will ingest log data that is stored as CSV files on a NiFi node connected to the drone's WiFi. This will eventually move to a dedicated embedded device running MiniFi. This is a small personal drone with less than 13 minutes of flight time per battery. This is not a commercial drone, but gives you an idea of the what you can do with drones. Drone Live Communications for Sensor Readings and Drone Control You must connect to the drone…