All Projects → spoddutur → Spark As Service Using Embedded Server

spoddutur / Spark As Service Using Embedded Server

This application comes as Spark2.1-as-Service-Provider using an embedded, Reactive-Streams-based, fully asynchronous HTTP server

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Spark As Service Using Embedded Server

Akka Http Microservice
Example of http (micro)service in Scala & akka-http
Stars: ✭ 701 (+1423.91%)
Mutual labels:  akka, akka-http
Es Cqrs Shopping Cart
A resilient and scalable shopping cart system designed using Event Sourcing (ES) and Command Query Responsibility Segregation (CQRS)
Stars: ✭ 19 (-58.7%)
Mutual labels:  akka, akka-http
Kafka Storm Starter
Code examples that show to integrate Apache Kafka 0.8+ with Apache Storm 0.9+ and Apache Spark Streaming 1.1+, while using Apache Avro as the data serialization format.
Stars: ✭ 728 (+1482.61%)
Mutual labels:  spark, apache-spark
Akka Http Json
Integrate some of the best JSON libs in Scala with Akka HTTP
Stars: ✭ 530 (+1052.17%)
Mutual labels:  akka, akka-http
Live log analyzer spark
Spark Application for analysis of Apache Access logs and detect anamolies! Along with Medium Article.
Stars: ✭ 14 (-69.57%)
Mutual labels:  spark, apache-spark
Eliasdb
EliasDB a graph-based database.
Stars: ✭ 611 (+1228.26%)
Mutual labels:  rest-api, embedded
Goodreads etl pipeline
An end-to-end GoodReads Data Pipeline for Building Data Lake, Data Warehouse and Analytics Platform.
Stars: ✭ 793 (+1623.91%)
Mutual labels:  spark, apache-spark
Spark Structured Streaming Book
The Internals of Spark Structured Streaming
Stars: ✭ 371 (+706.52%)
Mutual labels:  spark, apache-spark
Mobius
C# and F# language binding and extensions to Apache Spark
Stars: ✭ 929 (+1919.57%)
Mutual labels:  spark, apache-spark
Chronicler
Scala toolchain for InfluxDB
Stars: ✭ 24 (-47.83%)
Mutual labels:  spark, akka-http
Akka Http Session
Web & mobile client-side akka-http sessions, with optional JWT support
Stars: ✭ 429 (+832.61%)
Mutual labels:  akka, akka-http
Real Time Stream Processing Engine
This is an example of real time stream processing using Spark Streaming, Kafka & Elasticsearch.
Stars: ✭ 37 (-19.57%)
Mutual labels:  spark, apache-spark
Sparkle
Haskell on Apache Spark.
Stars: ✭ 419 (+810.87%)
Mutual labels:  spark, apache-spark
Spark Examples
Spark examples
Stars: ✭ 41 (-10.87%)
Mutual labels:  spark, apache-spark
Agile data code 2
Code for Agile Data Science 2.0, O'Reilly 2017, Second Edition
Stars: ✭ 413 (+797.83%)
Mutual labels:  spark, apache-spark
Sparklyr
R interface for Apache Spark
Stars: ✭ 775 (+1584.78%)
Mutual labels:  spark, apache-spark
Akka Grpc
Akka gRPC
Stars: ✭ 361 (+684.78%)
Mutual labels:  akka, akka-http
Sparkmeasure
This is the development repository of SparkMeasure, a tool for performance troubleshooting of Apache Spark workloads. It simplifies the collection and analysis of Spark task metrics data.
Stars: ✭ 368 (+700%)
Mutual labels:  spark, apache-spark
Scale
Another example of a REST API with Akka HTTP
Stars: ✭ 23 (-50%)
Mutual labels:  akka, akka-http
Spark Flamegraph
Easy CPU Profiling for Apache Spark applications
Stars: ✭ 30 (-34.78%)
Mutual labels:  spark, apache-spark

spark-as-service-using-embedded-server

This application comes as Spark2.1-REST-Service-Provider using an embedded, Reactive-Streams-based, fully asynchronous HTTP server.

1. Central Idea

I wanted to build an interactive REST api service on top of my ApacheSpark application which serves use-cases like:

- Load the trained model in SparkSession and quickly do the prediction for user given query._
- Have your big-data cached in cluster and provide user an endpoint to query it.
- Run some recurrent spark queries with varying parameters.

As you can see that the core of the application is not primarily a web-application OR browser-interaction but to have REST service performing big-data cluster-computation on ApacheSpark.

2. Akka-HTTP as apt-fit:

With Akka-Http, you normally don’t build your application on top of Akka HTTP, but you build your application on top of whatever makes sense and use Akka HTTP merely for the HTTP integration needs. So, I found Akka-HTTP to be right fit for the usecases mentioned above.

3. Architecture

3.1 To demo this, I've configured following four routes:

  1. homepage - http://localhost:8001 - says "hello world"
  2. version - http://localhost:8001/version - queries shared SparkSession and tells "spark version"
  3. activeStreams - http://localhost:8001/activeStreams - tells how many spark streams are active currently
  4. count - http://localhost:8001/count - random spark job to count number of elements in a sequence.

Following picture illustrates the routing of a HttpRequest:

4. Building

It uses Scala 2.11, Spark 2.1 and Akka-Http

mvn clean install

5. Execution

We can start our application as stand-alone jar like this:

mvn exec:java

5.1 cmd-line-args

Optionally, you can provide configuration params like spark-master, akka-port etc from command line. To see the list of configurable params, just type:

mvn exec:java -Dexec.args="--help" 
OR 
mvn exec:java -Dexec.args=“-h"
Help content will look something like this:
This application comes as Spark2.1-REST-Service-Provider using an embedded,
Reactive-Streams-based, fully asynchronous HTTP server (i.e., using akka-http).
So, this application needs config params like AkkaWebPort to bind to, SparkMaster
and SparkAppName

Usage: spark-submit spark-as-service-using-embedded-server.jar [options]
  Options:
  -h, --help
  -m, --master <master_url>                    spark://host:port, mesos://host:port, yarn, or local. Default: local
  -n, --name <name>                            A name of your application. Default: SparkAsRestService
  -p, --akkaHttpPort <portnumber>              Port where akka-http is binded. Default: 8001

5.2 Tweak Default cmd-line args

There are 2 ways to change the default param values:

  1. Update src/main/resources/application.conf file directly. Build and then Run
  2. mvn exec:java -Dexec.args="--master <master> --name <spark-app-name> --akkaHttpPort <port-to-which-akka-should-listen-to>"

6. References

Akka

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].