<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Apache Spark</title>
    <link>https://www.devkuma.com/en/tags/apache-spark/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/apache-spark/logo/180x180.jpg</url>
      <title>Apache Spark</title>
      <link>https://www.devkuma.com/en/tags/apache-spark/</link>
    </image>
    <description>Recent content in Apache Spark on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/apache-spark/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Apache Spark</title>
      <link>https://www.devkuma.com/en/docs/apache-spark/</link>
      <pubDate>Sat, 24 Dec 2022 10:22:54 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/apache-spark/</guid>
      <description>
        
        
        &lt;h2 id=&#34;apache-spark-overview&#34;&gt;Apache Spark Overview&lt;/h2&gt;
&lt;p&gt;Apache Spark is a &lt;strong&gt;distributed processing framework for cluster computing&lt;/strong&gt; that processes large-scale data such as big data and machine learning workloads. Spark development began in 2009 at AMPLab at the University of California, Berkeley, by Mate Zaharia, who was also a Hadoop committer. It is now managed and developed as one of the top-level projects of the Apache Software Foundation.&lt;/p&gt;
&lt;p&gt;Spark was developed to improve the slow processing speed of traditional MapReduce and to support a more flexible processing style that is not bound to repeatedly using Map and Reduce.&lt;/p&gt;
&lt;p&gt;Spark can run independently as a distributed processing framework, so it is attracting attention as a post-Hadoop technology. At the same time, it can also be used as a replacement for MapReduce within the Hadoop core system, which consists of MapReduce, HDFS, YARN, and related components.&lt;/p&gt;
&lt;h2 id=&#34;key-features-of-apache-spark&#34;&gt;Key Features of Apache Spark&lt;/h2&gt;
&lt;p&gt;Spark&amp;rsquo;s major features include the ability to easily program flexible processing models using the concise APIs provided by Spark, and the ability to process large-scale data in far less time than traditional MapReduce.&lt;/p&gt;
&lt;p&gt;In traditional MapReduce, Map and Reduce had to be performed as one processing model, so applications running on Hadoop had to be developed according to that style. This made it difficult to develop flexible processing models.&lt;/p&gt;
&lt;p&gt;MapReduce also writes processing results to disk after each Map and Reduce operation, making it difficult to improve processing speed. In contrast, Spark can run multiple Map operations consecutively on datasets loaded into memory (RDDs), reduce the results, and then run the next Map operation on the same dataset while keeping it in memory rather than writing it to disk. For this reason, Spark can sometimes achieve more than 100 times faster processing than MapReduce, although it can also write results to disk like traditional MapReduce.&lt;/p&gt;
&lt;p&gt;Spark&amp;rsquo;s features are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Speed
&lt;ul&gt;
&lt;li&gt;Fast in-memory processing&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ease of Use
&lt;ul&gt;
&lt;li&gt;Ease of use through support for various languages such as Java, Scala, Python, R, and SQL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Generality
&lt;ul&gt;
&lt;li&gt;Provides various components such as SQL, Streaming, machine learning, and graph computation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run Everywhere
&lt;ul&gt;
&lt;li&gt;Can run on various clusters such as YARN, Mesos, and Kubernetes&lt;/li&gt;
&lt;li&gt;Supports various file formats and storage systems such as HDFS, Cassandra, and HBase&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;apache-spark-component-structure&#34;&gt;Apache Spark Component Structure&lt;/h2&gt;
&lt;p&gt;Spark is a distributed processing framework consisting of the following components.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Spark Core, including Scala, Java, Python, and R APIs&lt;/li&gt;
&lt;li&gt;Spark SQL + DataFrames&lt;/li&gt;
&lt;li&gt;Spark Streaming&lt;/li&gt;
&lt;li&gt;MLlib&lt;/li&gt;
&lt;li&gt;GraphX&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;spark-core&#34;&gt;Spark Core&lt;/h3&gt;
&lt;p&gt;Spark keeps data to be processed in the form of RDDs (Resilient Distributed Datasets).&lt;br&gt;
An RDD is an immutable collection that can be executed in parallel and is distributed across computers.&lt;br&gt;
In the Spark programming model, processing is performed by applying various methods provided by Spark Core to these RDDs. When developers manipulate RDDs through the APIs provided by Spark Core, they can perform distributed processing without being conscious of distributed data.&lt;br&gt;
This is one of Spark&amp;rsquo;s strengths: it makes flexible processing easy to program.&lt;br&gt;
Spark Core APIs are provided not only for Scala, Spark&amp;rsquo;s development language, but also for Java, Python, and R as standard APIs. Some third-party libraries also provide Spark API access from Clojure, a functional language that runs on the JVM like Scala, and APIs for other languages are expected to continue increasing.&lt;/p&gt;
&lt;h3 id=&#34;spark-sql--dataframes&#34;&gt;Spark SQL + DataFrames&lt;/h3&gt;
&lt;p&gt;In addition to manipulating RDDs through Spark APIs, Spark can also use a SQL-like language called Spark SQL to manipulate abstract datasets called DataFrames, which have named columns like database tables.&lt;br&gt;
This is an interface that allows users who have not learned languages such as Scala, Java, Python, or R to process data with Spark if they have SQL knowledge.&lt;/p&gt;
&lt;h3 id=&#34;spark-streaming&#34;&gt;Spark Streaming&lt;/h3&gt;
&lt;p&gt;Spark Streaming is an engine that provides real-time distributed processing for streaming data continuously sent to Spark.&lt;br&gt;
Apache Storm is a similar framework for processing streaming data. While Apache Storm is specialized for streaming data processing, Spark Streaming is Spark&amp;rsquo;s engine for real-time data processing.&lt;br&gt;
Apache Flink is another streaming processing framework. Because it can also perform batch processing and includes machine learning and graph processing libraries, it has a structure quite similar to Spark and is considered a Spark competitor.&lt;/p&gt;
&lt;p&gt;Apache Storm&lt;br&gt;
&lt;a href=&#34;http://storm.apache.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://storm.apache.org/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Apache Flink&lt;br&gt;
&lt;a href=&#34;http://flink.apache.org/introduction.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://flink.apache.org/introduction.html&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;mllib&#34;&gt;MLlib&lt;/h3&gt;
&lt;p&gt;MLlib is Spark&amp;rsquo;s machine learning library. It allows users to write programs that perform machine learning using Spark&amp;rsquo;s flexible processing style.&lt;br&gt;
Before this, Mahout existed as software for machine learning in cooperation with Hadoop, but Hadoop + Mahout required machine learning programs to be written using the MapReduce programming model, which caused slower processing.&lt;br&gt;
Spark can process faster than Hadoop, and machine learning using Spark and MLlib is attracting attention because it is efficient.&lt;/p&gt;
&lt;p&gt;Apache Mahout&lt;br&gt;
&lt;a href=&#34;http://mahout.apache.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://mahout.apache.org/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;graphx&#34;&gt;GraphX&lt;/h3&gt;
&lt;p&gt;GraphX provides APIs for parallel processing of graph data through Spark.&lt;br&gt;
It enables parallel processing of graph data with Spark&amp;rsquo;s fast processing speed.&lt;/p&gt;
&lt;p&gt;Some components described above do not include storage components.
Spark can use various existing storage systems for reading and writing. The following are some storage systems that can be integrated with Spark, including through third-party libraries.&lt;/p&gt;
&lt;p&gt;HDFS, Cassandra, HBase, S3, MongoDB, Couchbase, Riak, Neo4j, OrientDB&lt;/p&gt;
&lt;p&gt;Readable data sources also vary widely, from files such as CSV and XML to search engines such as Solr and Elasticsearch.&lt;/p&gt;
&lt;p&gt;List of packages for integration between Spark and various data sources&lt;br&gt;
&lt;a href=&#34;https://spark-packages.org/?q=tags%3A%22Data%20Sources%22&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://spark-packages.org/?q=tags%3A%22Data%20Sources%22&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In addition to packages that enable integration with various data sources, various packages for extending the existing Spark ecosystem are also provided.
These packages are published as Spark Packages at the following site.&lt;br&gt;
&lt;a href=&#34;https://spark-packages.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://spark-packages.org/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;apache-spark-operating-environment&#34;&gt;Apache Spark Operating Environment&lt;/h2&gt;
&lt;p&gt;Spark officially supports the following OS environments. Java must also be installed to run Spark.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Major Linux distributions&lt;/li&gt;
&lt;li&gt;Windows&lt;/li&gt;
&lt;li&gt;Linux&lt;/li&gt;
&lt;li&gt;MacOSX&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Versions supported by the APIs provided by Spark are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Java 8, 11, 17 (versions below Java 8u201 are deprecated in Spark 3.2.0)&lt;/li&gt;
&lt;li&gt;Scala 2.12, 2.13 (Spark 3.3.0 must use a compatible Scala 2.12.x version)&lt;/li&gt;
&lt;li&gt;Python 3.7 or later (with Python 3.9, Apache Arrow and pandas UDFs might not work)&lt;/li&gt;
&lt;li&gt;R 3.5 or later&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;apache-spark-license-type&#34;&gt;Apache Spark License Type&lt;/h2&gt;
&lt;p&gt;Spark is one of Apache&amp;rsquo;s top-level projects.&lt;br&gt;
The license is Apache License 2.0, and users are not restricted in using, distributing, modifying, or distributing derivative versions of the software.&lt;/p&gt;
&lt;h2 id=&#34;apache-spark-reference-information&#34;&gt;Apache Spark Reference Information&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://spark.apache.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Spark official site&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://spark.apache.org/docs/latest/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Spark official documentation&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.databricks.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Spark community site&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is provided by Databricks, a company started by Spark developers.&lt;/p&gt;

      </description>
      
      <category>BigData</category>
      
      <category>Apache Spark</category>
      
    </item>
    
    <item>
      <title>PySpark Concepts and Key Features</title>
      <link>https://www.devkuma.com/en/docs/pyspark/</link>
      <pubDate>Fri, 06 Jan 2023 12:36:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/pyspark/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-pyspark&#34;&gt;What Is PySpark?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://spark.apache.org/docs/latest/api/python/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PySpark&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is the Python API for Apache Spark, an open source distributed computing framework and set of libraries for real-time large-scale data processing. If you are already familiar with Python and libraries such as Pandas, PySpark is a good language for learning how to build more scalable analytics and pipelines.&lt;/p&gt;
&lt;p&gt;Apache Spark is basically a compute engine that works with huge datasets by processing them in parallel and batch systems. Spark is written in Scala, and PySpark was released to support collaboration between Spark and Python. In addition to providing APIs for Spark, PySpark uses the Py4J library to support interfaces with RDDs (Resilient Distributed Datasets).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/apache-spark/python-spark-pyspark.png&#34; alt=&#34;Apache Spark and Python logos&#34;&gt;&lt;/p&gt;
&lt;p&gt;The main data type used in PySpark is the Spark DataFrame. This object can be thought of as a table distributed across a cluster, and it has functionality similar to data frames in R and Pandas. To perform distributed computation with PySpark, you must run operations on Spark DataFrames rather than other Python data types.&lt;/p&gt;
&lt;p&gt;One of the main differences between Pandas and Spark DataFrames is eager execution versus lazy execution. In PySpark, operations are delayed until results are actually requested in the pipeline. For example, you can specify a job that loads a dataset from Amazon S3 and applies multiple transformations to a DataFrame, but those operations are not applied immediately. Instead, the transformation graph is recorded, and when the data is actually needed, such as when writing results back to S3, the transformations are applied as a single pipeline job. This approach is used to avoid bringing the entire DataFrame into memory and to enable more effective processing across a cluster of systems. With Pandas DataFrames, everything is brought into memory and all Pandas operations are applied immediately.&lt;/p&gt;
&lt;h2 id=&#34;pyspark-features-and-libraries&#34;&gt;PySpark Features and Libraries&lt;/h2&gt;
&lt;p&gt;Py4J is a widely used library integrated into PySpark that enables Python to dynamically interface with JVM (Java Virtual Machine) objects. PySpark provides many libraries for writing efficient programs. It is also compatible with various external libraries, including the following.&lt;/p&gt;
&lt;h3 id=&#34;pysparksql&#34;&gt;PySparkSQL&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://spark.apache.org/docs/2.4.0/api/python/pyspark.sql.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PySparkSQL&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is a PySpark library that applies SQL-like analysis to large volumes of structured or semi-structured data. SQL queries can also be used with PySparkSQL.&lt;/p&gt;
&lt;h3 id=&#34;mllib&#34;&gt;MLlib&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://spark.apache.org/docs/latest/ml-guide.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MLlib&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is the wrapper machine learning (ML) library for PySpark and Spark. MLlib supports many machine learning algorithms for classification, regression, clustering, collaborative filtering, dimensionality reduction, and basic optimization primitives.&lt;/p&gt;
&lt;h3 id=&#34;graphframes&#34;&gt;GraphFrames&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://graphframes.github.io/graphframes/docs/_site/index.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GraphFrames&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is a graph processing library that provides a set of APIs for efficiently performing graph analysis using PySpark Core and PySparkSQL. It is optimized for fast distributed computing.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;For data engineers who know Python but not Scala, PySpark is much easier to use than pure Spark, but it also has drawbacks. PySpark errors show both Java stack trace errors and references to Python code, so debugging PySpark applications can be very difficult.&lt;/p&gt;
&lt;p&gt;Spark includes more processing overhead and more complex setup than other data processing options. Ray and Dask have emerged recently. Because Dask is a pure Python framework, most data engineers can use Dask immediately.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.databricks.com/kr/glossary/pyspark&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PySpark – Databricks&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.dominodatalab.com/data-science-dictionary/pyspark&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;What is PySpark? | Domino Data Science Dictionary&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>BigData</category>
      
      <category>Apache Spark</category>
      
      <category>PySpark</category>
      
    </item>
    
  </channel>
</rss>
