title: Using Apache Spark as a backend for web application
body: <p>We have Terabytes of data stored in HDFS, comprising of customer data and behavioral information. Business Analysts want to perform slicing and dicing of this data using filters. </p>
  
  <p>These filters are similar to Spark RDD filters. Some examples of the filter are:
  <code>age &gt; 18 and age &lt; 35</code>, <code>date between 10-02-2015, 20-02-2015</code>, <code>gender=male</code>, <code>country in (UK, US, India)</code>, etc. We want to integrate this filter functionality in our JSF (or Play) based web application. </p>
  
  <p>Analysts would like to experiment by applying/removing filters, and verifying if the count of the final filtered data is as desired. This is a repeated exercise, and the maximum number of people using this web application could be around 100. </p>
  
  <p>We are planning to use Scala as a programming language for implementing the filters. The web application would initialize a single SparkContext at the load of the server, and every filter would reuse the same SparkContext. </p>
  
  <p>Is Spark good for this use case of interactive querying through a web application. Also, the idea of sharing a single SparkContext, is this a work-around approach? The other alternative we have is Apache Hive with Tez engine using ORC compressed file format, and querying using JDBC/Thrift. Is this option better than Spark, for the given job?</p>