Scala vs. Python for Apache Spark

综合编程 2018-02-13

Apache Spark is a great choice for cluster computing and includes language APIs for Scala, Java, Python, and R. Apache Spark includes libraries for SQL, streaming, machine learning, and graph processing. This broad set of functionality leads many developers to start developing against Apache Spark for distributed applications.

The first big decision you have is where to run it. For most, that's a no-brainer - run it on Apache Hadoop YARN on your existing cluster. After that tough decision, the harder one for developers and enterprises is what language to develop in. Do you have to allow users to pick their own and support multiple languages? This will result in code and tool sprawl, and the R interface is not quite as rich. For most enterprises, seeing how verbose and uncommon the Java interface is, this leads them down the path to either Python or Scala. I am here to tear apart both options and rebuild them and see who is left standing.

Scala has a major advantage in that it is the language that the Apache Spark platform is written in. Scala on JVM is a very powerful language that is cleaner than Java and just as powerful. Using the JVM, your applications can scale to a massive size. For most applications, this is a big deal, but with Apache Spark already being distributed with Akka and YARN, it's not necessary. You merely set a few parameters and your Apache Spark application will be distributed for you regardless of your language. So, this is not an advantage anymore.

Python has become a first-class citizen in the Spark World. It is also a very easy language to start with and many schools are teaching it to children. There is a wealth of example code, books, articles, libraries, documentation, and help available for this language.

PySpark is the default place to be in Spark. With Apache Zeppelin's strong PySpark support, as well as Jupyter and IBM DSX using Python as a first-class language, you have many notebooks to use to develop code, test it, run queries, build visualizations and collaborate with others. Python is becoming the lingua franca for Data Scientists, Data Engineers, and Streaming developers. Python also is well integrated with Apache NiFi.

Python has the advantage of a very rich set of machine learning, processing, NLP, and deep learning libraries available. You also don't need to compile your code first and worry about complex JVM packaging. Using Anaconda or Pip is pretty standard and Apache Hadoop and Apache Spark clusters already have Python and their libraries installed for other purposes like Apache Ambari.

Some of the amazing libraries available for Python include NLTK, TensorFlow, Apache MXNet, TextBlob, SpaCY, and Numpy.

Python Pros

  • PySpark is listed in all the examples and is no longer an afterthought.

  • Most libraries come out with Python APIs first.

  • Python is a mature language.

  • Python usage continues to grow.

  • Deep learning libraries are including Python.

  • Included in all notebooks.

  • Ease of use.

Scala Pros

  • JVM

  • Strong IDEs and unit testing

  • Great serialization formats



责编内容by:DZone (源链)。感谢您的支持!


Read, Write and Display a video using OpenCV ( C++... In this post, we will learn how to read, write and display videos in OpenCV. Before we do that,...
一句话开启简单的服务器 在渗透测试时,有时候控制了目标服务器,可以执行系统命令。为了方便直观的浏览和从目标服务器上取得一些文件,这个时候可以尝试使用系统支持的python、php或ruby命令开启一个HTTP服务器或者FTP...
Python学习笔记二十(MySQL、SQL、联表查询)... 联表查询(多表查询) create table article( id int unsigned auto_increment primary key, title varchar(100)...
爬取《The Hitchhiker’s Guide to Python!》python进阶书并制成p... 这是日常学python的第15篇原创文章 前几篇文章我们学习了requests库和正则,还有个urllib库,我上篇文章也用了requests库来教大家去爬那些返回json格式的网页,挺好玩的。有...
Check if a Python script is already running in Win... What is the best/easiest why to check if a specific Python script already running in Windows? I...