What is Apache Storm on Azure HDInsight?
Apache Storm is a distributed, fault-tolerant, open-source computation system. You can use Storm to process streams of data in real time with Apache Hadoop. Storm solutions can also provide guaranteed processing of data, with the ability to replay data that wasn't successfully processed the first time.
Why use Apache Storm on HDInsight?
Storm on HDInsight provides the following features:
99% Service Level Agreement (SLA) on Storm uptime: Storm on HDInsight comes with full continuous support. Storm on HDInsight also has an SLA of 99.9 percent. That means Microsoft guarantees that a Storm cluster has external connectivity at least 99.9 percent of the time. For more information, see Azure support. See also, SLA information for HDInsight document.
Supports easy customization by running scripts against a Storm cluster during or after creation. For more information, see Customize HDInsight clusters using script action.
Create solutions in multiple languages: You can write Storm components in the language of your choice, such as Java, C#, and Python.
Integrates Visual Studio with HDInsight for the development, management, and monitoring of C# topologies. For more information, see Develop C# Storm topologies with the HDInsight Tools for Visual Studio.
Supports the Trident Java interface. You can create Storm topologies that support exactly once processing of messages, transactional datastore persistence, and a set of common stream analytics operations.
Dynamic scaling: You can add or remove worker nodes with no impact to running Storm topologies. Deactivate and reactivate running topologies to take advantage of new nodes added through scaling operations.
Create streaming pipelines using multiple Azure services: Storm on HDInsight integrates with other Azure services. Such as Event Hubs, SQL Database, Azure Storage, and Azure Data Lake Storage. For an example solution that integrates with Azure services, see Process events from Event Hubs with Apache Storm on HDInsight.
For a list of companies that are using Apache Storm for their real-time analytics solutions, see Companies using Apache Storm.
To get started using Storm, see Create and monitor an Apache Storm topology in Azure HDInsight.
How does Apache Storm work
Storm runs topologies instead of the Apache Hadoop MapReduce jobs that you might be familiar with. Storm topologies are composed of multiple components that are arranged in a directed acyclic graph (DAG). Data flows between the components in the graph. Each component consumes one or more data streams, and can optionally emit one or more streams. The following diagram illustrates how data flows between components in a basic word-count topology:
Spout components bring data into a topology. They emit one or more streams into the topology.
Bolt components consume streams emitted from spouts or other bolts. Bolts might optionally emit streams into the topology. Bolts are also responsible for writing data to external services or storage, such as HDFS, Kafka, or HBase.
Apache Storm guarantees that each incoming message is always fully processed, even when the data analysis is spread over hundreds of nodes.
The Nimbus node provides functionality similar to the Apache Hadoop JobTracker. Nimbus assigns tasks to other nodes in a cluster through Apache ZooKeeper. Zookeeper nodes provide coordination for a cluster and assist communication between Nimbus and the Supervisor process on the worker nodes. If one processing node goes down, the Nimbus node is informed, and it assigns the task and associated data to another node.
The default configuration for Apache Storm clusters is to have only one Nimbus node. Storm on HDInsight provides two Nimbus nodes. If the primary node fails, the Storm cluster switches to the secondary node while the primary node is recovered. The following diagram illustrates the task flow configuration for Storm on HDInsight:
Ease of use
|Secure Shell (SSH) connectivity||You can access the head nodes of your Storm cluster over the Internet by using SSH. You can run commands directly on your cluster by using SSH. For more information, see Use SSH with HDInsight.|
|Web connectivity||All HDInsight clusters provide the Ambari web UI. You can easily monitor, configure, and manage services on your cluster by using the Ambari web UI. Storm clusters also provide the Storm UI. You can monitor and manage running Storm topologies from your browser by using the Storm UI. For more information, see the Manage HDInsight using the Apache Ambari Web UI and Monitor and manage using the Apache Storm UI documents.|
|Azure PowerShell and Azure CLI||PowerShell and Azure CLI both provide command-line utilities that you can use from your client system to work with HDInsight and other Azure services.|
|Visual Studio integration||Azure Data Lake Tools for Visual Studio include project templates for creating C# Storm topologies by using the SCP.NET framework. Data Lake Tools also provide tools to deploy, monitor, and manage solutions with Storm on HDInsight. For more information, see Develop C# Storm topologies with the HDInsight Tools for Visual Studio.|
Integration with other Azure services
Azure Data Lake Storage: See Use Azure Data Lake Storage with Apache Storm on HDInsight.
Event Hubs: For an example of using Event Hubs with a Storm cluster, see the following examples:
SQL Database, Cosmos DB, Event Hubs, and HBase: Template examples are included in the Data Lake Tools for Visual Studio. For more information, see Develop a C# topology for Apache Storm on HDInsight.
Apache Storm use cases
The following are some common scenarios for which you might use Storm on HDInsight:
- Internet of Things (IoT)
- Fraud detection
- Social analytics
- Extraction, transformation, and loading (ETL)
- Network monitoring
- Mobile engagement
For information about real-world scenarios, see the How companies are using Apache Storm document.
.NET developers can design and implement topologies in C# by using Data Lake Tools for Visual Studio. You can also create hybrid topologies that use Java and C# components. For more information, see Develop C# topologies for Apache Storm on HDInsight using Visual Studio.
You can also develop Java solutions by using the IDE of your choice. For more information, see Develop Java topologies for Apache Storm on HDInsight.
Python can also be used to develop Storm components. For more information, see Develop Apache Storm topologies using Python on HDInsight.
Common development patterns
Guaranteed message processing
Apache Storm can provide different levels of guaranteed message processing. For example, a basic Storm application guarantees at-least-once processing, and Trident can guarantee exactly once processing. See Guarantees on data processing at apache.org.
The pattern of reading an input tuple, emitting zero or more tuples, and then confirming the input tuple immediately at the end of the execute method is common. Storm provides the IBasicBolt interface to automate this pattern.
How data streams are joined varies between applications. For example, you can join each tuple from multiple streams into one new stream, or join only batches of tuples for a specific window. Either way, joining can be accomplished by using fieldsGrouping. Field grouping is a way of defining how tuples are routed to bolts.
In the following Java example, fieldsGrouping is used to route tuples that originate from components "1", "2", and "3" to the MyJoiner bolt:
builder.setBolt("join", new MyJoiner(), parallelism) .fieldsGrouping("1", new Fields("joinfield1", "joinfield2")) .fieldsGrouping("2", new Fields("joinfield1", "joinfield2")) .fieldsGrouping("3", new Fields("joinfield1", "joinfield2"));
Apache Storm provides an internal timing mechanism known as a "tick tuple." You can set how often a tick tuple is emitted in your topology.
For an example of using a tick tuple from a C# component, see PartialBoltCount.cs.
In-memory caching is often used as a mechanism for speeding up processing because it keeps frequently used assets in memory. Because a topology is distributed across multiple nodes, and multiple processes within each node, you should consider using fieldsGrouping. Use
fieldsGrouping to ensure that tuples containing the fields that are used for cache lookup are always routed to the same process. This grouping functionality avoids duplication of cache entries across processes.
Stream "top N"
When your topology depends on calculating a top N value, calculate the top N value in parallel. Then merge the output from those calculations into a global value. This operation can be done by using fieldsGrouping to route by field for parallel processing. Then you can route to a bolt that globally determines the top N value.
For an example of calculating a top N value, see the RollingTopWords example.
Storm uses Apache Log4j 2 to log information. By default, a large amount of data is logged, and it can be difficult to sort through the information. You can include a logging configuration file as part of your Storm topology to control logging behavior.
For an example topology that demonstrates how to configure logging, see Java-based WordCount example for Storm on HDInsight.
Learn more about real-time analytics solutions with Apache Storm on HDInsight: