DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Zero Trust for AWS NLBs: Why It Matters and How to Do It
  • A Guide to Microservices Deployment: Elastic Beanstalk vs Manual Setup
  • A Deep Dive on Read Your Own Writes Consistency
  • Mastering Load Balancers: Optimizing Traffic for High Availability and Performance

Trending

  • Dropwizard vs. Micronaut: Unpacking the Best Framework for Microservices
  • Building Resilient Networks: Limiting the Risk and Scope of Cyber Attacks
  • Kullback–Leibler Divergence: Theory, Applications, and Implications
  • AI-Driven Test Automation Techniques for Multimodal Systems
  1. DZone
  2. Data Engineering
  3. Data
  4. Modern Apache NiFi Load Balancing

Modern Apache NiFi Load Balancing

By 
Tim Spann user avatar
Tim Spann
DZone Core CORE ·
Dec. 19, 19 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
24.8K Views

Join the DZone community and get the full member experience.

Join For Free

In today's Apache NiFi, there is a new and improved means of load balancing data between nodes in a 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 the 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 a newer version of Apache NiFI or Cloudera Flow Management (CFM), you have had a better way of distributing processing between processors and servers. This is for versions of Apache NiFi 1.8.0 and higher, including the newest version 1.10.0.

Note: Remote Process Groups are no longer necessary for load balancing! Use an actual load-balanced connection instead! Remote Process Groups should only be used for distributing to other clusters.

Load balancing in Apache NiFi

Load balancing in Apache NiFi


You may also like: Apache NiFi 1.0.0: Zero-Master Clustering.

Apache NiFi Load Balancing 


Since 2018, it's been an awesome feature: https://blogs.apache.org/nifi/entry/load-balancing-across-the-cluster.

Configuring a connection

Configuring a connection


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

Round robin for load balancing

Round Robin for load balancing

Data Distribution Strategies


Another 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” to be sent to the same node in a cluster that may be necessary for certain use cases.     

Using a custom Attribute Name for this routing can be powerful 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 money.

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 the first connection, like ListSFTP that 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 records will require you to 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 tables.  

This is how trivial it is to implement and easy for any NiFi user to examine and see what is going on in an ETL process.

References

  • https://pierrevillard.com/2018/10/29/nifi-1-8-revolutionizing-the-list-fetch-pattern-and-more/.
  • https://community.cloudera.com/t5/Community-Articles/Using-Apache-NiFi-for-Speech-Processing-Speech-to-Text-with/ta-p/249242.
  • https://community.cloudera.com/t5/Community-Articles/NiFi-Understanding-how-to-use-Process-Groups-and-Remote/ta-p/245486.
  • https://cwiki.apache.org/confluence/display/NIFI/Load-Balanced+Connections.
  • https://cwiki.apache.org/confluence/display/NIFI/Clustering+Redesign.
  • https://blogs.apache.org/nifi/entry/load-balancing-across-the-cluster.



Further Reading

  • The Complete Apache Spark Collection [Tutorials and Articles].
  • Real-Time Stock Processing With Apache NiFi and Apache Kafka, Part 1.
Apache NiFi Load balancing (computing)

Opinions expressed by DZone contributors are their own.

Related

  • Zero Trust for AWS NLBs: Why It Matters and How to Do It
  • A Guide to Microservices Deployment: Elastic Beanstalk vs Manual Setup
  • A Deep Dive on Read Your Own Writes Consistency
  • Mastering Load Balancers: Optimizing Traffic for High Availability and Performance

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!