Skip to main content

Facebook's Presto

Listen:
In November 2013 Facebook published their Presto engine as Open Source, available at GitHub. Presto is a distributed interactive SQL query engine, able to run over dozens of modern BigData stores, based on Apache Hive or Cassandra. Presto comes with a limited JDBC Connector, supports Hive 0.13 with Parquet and Views.

Installation

Just a few specialties. Presto runs only with Java7, does not support Kerberos and does not have built-in user authentication, neither. To protect data a user should not be able to read, the use of HDFS Acl's / POSIX permissions should be considered. The setup of Presto is pretty easy and well documented. Just follow the documentation, use "uuidgen" to generate a unique ID for your Presto Node (node.id in node.properties) and add "hive" as datasource (config.properties: datasources=jmx,hive). I used user "hive" to start the server with:
export PATH=/usr/jdk64/jdk1.7.0_45/bin:$PATH && presto-server-0.68/bin/launcher start

After the successful start you should be able to connect to Presto's Webinterface (discovery.uri in config.properties). The UI is pretty simple, but a good point to see what happens with your queries, how many splits are created and what time each step takes.

The CLI is a stand-alone self-executing jar file and can be placed on any computer which has installed Java7 and can connect to the Presto Instance. To be sure that the client is using the correct Java version a PATH inclusion may make sense:
export PATH=/usr/jdk64/jdk1.7.0_45/bin:$PATH && /software/presto --server [your-presto-server]:[port] --catalog hive --schema default

presto:default> show tables;
    Table
--------------
 building
 hvac
 sample_07
 sample_08
 transactions

Now let's test if Presto is really fast and can compare with Impala. To make the tests more simple I wrote a small script which uses MR to generate sample data. Its available in my git-repo. Just run it as the user you want to be, maybe make it executable or use "sh". With the script I mentioned before I created a table called transactions, and this table we want to query. I post only 2 exemplary queries, but the script has a few more.

1. Finding highest gainers

select id, sum(amount) as amount from (select sender as id, amount * -1 as amount from transactions union all select recipient as id, amount from transactions) unionResult group by id order by amount desc limit 10;

Results
Hive: 39.078 seconds, Fetched: 10 row(s)
Tez: 18.227 seconds, Fetched: 10 row(s)
Presto: 0:02 [1.2M rows, 38.2MB] [720K rows/s, 22.9MB/s]


2. Finding fraudsters

select count(*) from (select a.sender, a.recipient, b.recipient as c from transactions a join transactions b on a.recipient = b.sender where a.time < b.time and b.time - a.time < 5) i;

Results
Hive: 208.065 seconds, Fetched: 1 row(s)
Tez: 101.758 seconds, Fetched: 1 row(s)
Presto: 1:02 [600K rows, 19.1MB] [9.7K rows/s, 317KB/s]

Conclusion

Since Tez brings a significant better performance, Presto brings light speed into Hadoop based SQL and can be measured with Impala. The advantage of Presto is the flexibility of connectors - the Presto Team will add more connectors for Oracle, MySQL, PostgresSQL and HBase very soon. Also Authentication (Kerberos), Authorization and SQL Grants will be supported within the next month [1].

Comments

  1. Thanks .. Can you please help me ...i hv installed presto in 2 nodes...but still when execute query, it shows running on 1 node. why so. Plz help

    ReplyDelete
  2. Anonymous10 June, 2014

    You need one PrestoServer, and on all other nodes you need the Discovery Service: http://prestodb.io/docs/current/installation/discovery.html

    Note, all nodes need a unique ID.

    ReplyDelete

Post a Comment

Popular posts from this blog

Beyond Ctrl+F - Use LLM's For PDF Analysis

PDFs are everywhere, seemingly indestructible, and present in our daily lives at all thinkable and unthinkable positions. We've all got mountains of them, and even companies shouting about "digital transformation" haven't managed to escape their clutches. Now, I'm a product guy, not a document management guru. But I started thinking: if PDFs are omnipresent in our existence, why not throw some cutting-edge AI at the problem? Maybe Large Language Models (LLMs) and Retrieval Augmented Generation (RAG) could be the answer. Don't get me wrong, PDF search indexes like Solr exist, but they're basically glorified Ctrl+F. They point you to the right file, but don't actually help you understand what's in it. And sure, Microsoft Fabric's got some fancy PDF Q&A stuff, but it's a complex beast with a hefty price tag. That's why I decided to experiment with LLMs and RAG. My idea? An intelligent knowledge base built on top of our existing P...

Deal with corrupted messages in Apache Kafka

Under some strange circumstances, it can happen that a message in a Kafka topic is corrupted. This often happens when using 3rd party frameworks with Kafka. In addition, Kafka < 0.9 does not have a lock on Log.read() at the consumer read level, but does have a lock on Log.write(). This can lead to a rare race condition as described in KAKFA-2477 [1]. A likely log entry looks like this: ERROR Error processing message, stopping consumer: (kafka.tools.ConsoleConsumer$) kafka.message.InvalidMessageException: Message is corrupt (stored crc = xxxxxxxxxx, computed crc = yyyyyyyyyy Kafka-Tools Kafka stores the offset of each consumer in Zookeeper. To read the offsets, Kafka provides handy tools [2]. But you can also use zkCli.sh, at least to display the consumer and the stored offsets. First we need to find the consumer for a topic (> Kafka 0.9): bin/kafka-consumer-groups.sh --zookeeper management01:2181 --describe --group test Prior to Kafka 0.9, the only way to get this in...

What Makes You The Number 1 Product Manager?

Amazon often does this thing where they start with the customer instead of just coming up with a product and then trying to figure out how to sell it. They call it " working backwards. " This strategy totally works for any product decisions, but it's especially important when they're making something new. The Press Release Exercise When it comes to launching new stuff, product managers usually start by writing a press release for customers. This press release is all about their pain points, how current solutions fall short, and how the new product is going to crush it. If the benefits don't get customers excited, the product manager needs to keep tweaking the press release until it sounds super awesome. It's way easier and cheaper to make changes to a press release than it is to change the product itself. Here’s a template I use to describe a new service or product: Main heade r: The product name anyone directly understands, like “Ultra-compact power charger” ...