Your cart is currently empty!
Author: alien
-
Khóa học miễn phí Apache Presto – Configuration nhận dự án làm có lương
Apache Presto – Configuration Settings
This chapter will discuss the configuration settings for Presto.
Presto Verifier
The Presto Verifier can be used to test Presto against another database (such as MySQL), or to test two Presto clusters against each other.
Create Database in MySQL
Open MySQL server and create a database using the following command.
create database test
Now you have created “test” database in the server. Create the table and load it with the following query.
CREATE TABLE verifier_queries( id INT NOT NULL AUTO_INCREMENT, suite VARCHAR(256) NOT NULL, name VARCHAR(256), test_catalog VARCHAR(256) NOT NULL, test_schema VARCHAR(256) NOT NULL, test_prequeries TEXT, test_query TEXT NOT NULL, test_postqueries TEXT, test_username VARCHAR(256) NOT NULL default ''verifier-test'', test_password VARCHAR(256), control_catalog VARCHAR(256) NOT NULL, control_schema VARCHAR(256) NOT NULL, control_prequeries TEXT, control_query TEXT NOT NULL, control_postqueries TEXT, control_username VARCHAR(256) NOT NULL default ''verifier-test'', control_password VARCHAR(256), session_properties_json TEXT, PRIMARY KEY (id) );
Add Config Settings
Create a properties file to configure the verifier −
$ vi config.properties suite = mysuite query-database = jdbc:mysql://localhost:3306/tutorials?user=root&password=pwd control.gateway = jdbc:presto://localhost:8080 test.gateway = jdbc:presto://localhost:8080 thread-count = 1
Here, in the query-database field, enter the following details − mysql database name, user name, and password.
Download JAR File
Download Presto-verifier jar file by visiting the following link,
Now the version “presto-verifier-0.149-executable.jar” is downloaded on your machine.
Execute JAR
Execute the JAR file using the following command,
$ mv presto-verifier-0.149-executable.jar verifier $ chmod+x verifier
Run Verifier
Run the verifier using the following command,
$ ./verifier config.properties
Create Table
Let’s create a simple table in “test” database using the following query.
create table product(id int not null, name varchar(50))
Insert Table
After creating a table, insert two records using the following query,
insert into product values(1,’Phone'') insert into product values(2,’Television’)
Run Verifier Query
Execute the following sample query in the verifier terminal (./verifier config.propeties) to check the verifier result.
Sample Query
insert into verifier_queries (suite, test_catalog, test_schema, test_query, control_catalog, control_schema, control_query) values (''mysuite'', ''mysql'', ''default'', ''select * from mysql.test.product'', ''mysql'', ''default'', ''select * from mysql.test.product'');
Here, select * from mysql.test.product query refers to mysql catalog, test is database name and product is table name. In this way, you can access mysql connector using Presto server.
Here, two same select queries are tested against each other to see the performance. Similarly, you can run other queries to test the performance results. You can also connect two Presto clusters to check the performance results.
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc
Khóa học miễn phí Apache Presto – Administration nhận dự án làm có lương
Apache Presto – Administration Tools
In this chapter, we will discuss the administration tools used in Presto. Let’s start with the Web Interface of Presto.
Web Interface
Presto provides a web interface for monitoring and managing queries. It can be accessed from the port number specified in the coordinator Config Properties.
Start Presto server and Presto CLI. Then you can access the web interface from the following url − http://localhost:8080/

The output will be similar to the above screen.
Here, the main page has a list of queries along with information like unique query ID, query text, query state, percentage completed, username and source from which this query is originated. Latest queries are running first, then completed or not completed queries are displayed at the bottom.
Tuning the Performance on Presto
If Presto cluster is having any performance-related issues, change your default configuration settings to the following settings.
Config Properties
-
task. info -refresh-max-wait − Reduces coordinator work load.
-
task.max-worker-threads − Splits the process and assigns to each worker nodes.
-
distributed-joins-enabled − Hash-based distributed joins.
-
node-scheduler.network-topology − Sets network topology to scheduler.
JVM Settings
Change your default JVM settings to the following settings. This will be helpful for diagnosing garbage collection issues.
-XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCCause -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintReferenceGC -XX:+PrintClassHistogramAfterFullGC -XX:+PrintClassHistogramBeforeFullGC -XX:PrintFLSStatistics = 2 -XX:+PrintAdaptiveSizePolicy -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount = 1
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc