Welcome!

@DXWorldExpo Authors: Yeshim Deniz, Pat Romanski, Liz McMillan, Zakia Bouachraoui, Carmen Gonzalez

Related Topics: @DXWorldExpo, @CloudExpo, Apache

@DXWorldExpo: Blog Post

Taking Apache Spark for a Spin | @BigDataExpo #BigData

What is Spark?

You might have looked at some of the articles on Apache Spark on the Web and wondered if you could try it out for yourself. While Spark and Hadoop are designed for clusters, you might think you need to have lots of nodes.

If you wanted to see what you could do with Spark, you could set up a home lab with a few servers from Ebay. But there’s no rule saying that you need more than one machine just to learn Spark. Today’s multi-core processors are like having a cluster already on your desk. Even better, with a laptop, you can pick up your cluster and take it with you. Try doing that with your rack-mount servers.

What is Spark?
If you’re looking to try out Apache Spark, it helps to know what it actually is. Spark is a cluster computing framework that builds on Hadoop to support not only cluster computing, but also real-time cluster computing.

Spark consists of the Spark Core, which handles the actual dispatching, scheduling and I/O. Spark’s key feature is the Resilient Distributed Dataset, or RDD. RDDs are the basic data abstraction, containing a distributed list of elements. You can perform actions on RDDs, which return values, and transformations, which return new RDDs. It’s similar to functional programming, where functions return outputs and don’t have any side effects.

Spark is so fast because it represents RDDs in memory—and because RDDs are lazily evaluated. Transformations will not be calculated until an action on the RDDs has been requested to produce some form of output.

Spark also gives you access to some powerful tools like the real-time Spark Streaming engine for streaming analytics and the MLlib machine learning library.

Installing Spark

Installing Spark is easy enough. While the MapR distribution is essential for production use, you can install Spark from the project website on your own machine, whether you’re running Windows or Linux. It’s a good idea to set up a virtual machine for exploring Spark, just to keep it separate and reduce the possible security risk of running a server on your machine. This way, you can just turn it off when you don’t need it. Linux is a good choice because that’s what most servers will be running.

You can install also install Spark from your favorite distribution’s package manager. At least with the package manager, you won’t have to worry about dependencies like Scala. You can also install them from the respective websites or even build from source if you want.

Using the REPL

One of Spark’s greatest strengths is its interactive capabilities. Like most modern languages, Spark offers a REPL: A Read-Eval-Print-Loop. It’s just like the shell, or a Python interactive prompt.

Spark is actually implemented in Scala and you can use Scala or Python interactively. Learning both of these languages is beyond the scope of this article, but Python tends to be more familiar to people than Scala. In any case, if you’re interested at all in technologies like Spark, you likely have experience in some programming, and either Scala or Python shouldn’t be too hard to pick up. Of course if you have experience in Java that will work as well.

When you’ve got Spark up and running, you’ll be able to try out all the actions and transformations on your data.

The Spark equivalent of a “Hello, world!” seems to be a word count.

Here is an example shown in Python:

text_file = spark.textFile("hdfs://...")

 

text_file.flatMap(lambda line: line.split())

.map(lambda word: (word, 1))

.reduceByKey(lambda a, b: a+b)

You can see that even in Python, Spark makes uses of functional programming concepts such as maps and lambdas. The Spark documentation has an extensive reference of commands for both Python and Scala. The shell lets you quickly and easily experiment with data. Give it a try for yourself to see what Spark can really do.

Conclusion

If you’ve been curious about Spark and its ability to offer both batch and stream processing, and want to try it out, there’s no need to feel left out just because you don’t have your own cluster. Whether you’re a developer, a student, or a manager, you can get a taste of what Apache Spark has to offer. When you’re ready for production use, opt for the MapR Spark distribution when you’re ready for a complete, reliable version.

To further explore Spark, jump over to Getting Started with Apache Spark: From Inception to Production, a free interactive ebook by James A. Scott.

More Stories By Jim Scott

Jim has held positions running Operations, Engineering, Architecture and QA teams in the Consumer Packaged Goods, Digital Advertising, Digital Mapping, Chemical and Pharmaceutical industries. Jim has built systems that handle more than 50 billion transactions per day and his work with high-throughput computing at Dow Chemical was a precursor to more standardized big data concepts like Hadoop.

DXWorldEXPO Digital Transformation Stories
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Enterprises are striving to become digital businesses for differentiated innovation and customer-centricity. Traditionally, they focused on digitizing processes and paper workflow. To be a disruptor and compete against new players, they need to gain insight into business data and innovate at scale. Cloud and cognitive technologies can help them leverage hidden data in SAP/ERP systems to fuel their businesses to accelerate digital transformation success.
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Charles Araujo is an industry analyst, internationally recognized authority on the Digital Enterprise and author of The Quantum Age of IT: Why Everything You Know About IT is About to Change. As Principal Analyst with Intellyx, he writes, speaks and advises organizations on how to navigate through this time of disruption. He is also the founder of The Institute for Digital Transformation and a sought after keynote speaker. He has been a regular contributor to both InformationWeek and CIO Insight...
Cloud is the motor for innovation and digital transformation. CIOs will run 25% of total application workloads in the cloud by the end of 2018, based on recent Morgan Stanley report. Having the right enterprise cloud strategy in place, often in a multi cloud environment, also helps companies become a more intelligent business. Companies that master this path have something in common: they create a culture of continuous innovation. In his presentation, Dilipkumar will outline the latest resear...
Everyone wants the rainbow - reduced IT costs, scalability, continuity, flexibility, manageability, and innovation. But in order to get to that collaboration rainbow, you need the cloud! In this presentation, we'll cover three areas: First - the rainbow of benefits from cloud collaboration. There are many different reasons why more and more companies and institutions are moving to the cloud. Benefits include: cost savings (reducing on-prem infrastructure, reducing data center foot print, redu...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
When building large, cloud-based applications that operate at a high scale, it’s important to maintain a high availability and resilience to failures. In order to do that, you must be tolerant of failures, even in light of failures in other areas of your application. “Fly two mistakes high” is an old adage in the radio control airplane hobby. It means, fly high enough so that if you make a mistake, you can continue flying with room to still make mistakes. In his session at 18th Cloud Expo, Lee A...