Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Apache Phoenix JDBC Issues

Highlighted

Apache Phoenix JDBC Issues

New Contributor

Hello guys,

I have a platform written on Javascript and we use Phoenix SQL to access HBASE. Apache Phoenix is working perfectly when we access from a terminal.

On the the Javascript side, when multiple users access to the website , each user have to wait so the queries of the first user finish loading ( it can't accept multiple queries from different users simultaneously)
Here's my config object :

 

 

var config = {
drivername: "org.apache.phoenix.jdbc.PhoenixDriver",
url:
"jdbc:phoenix:52.161.106.147,52.161.18.215,52.161.8.171,13.78.190.223:2181:/hbase-unsecure",
user: "",
password: "",
minpoolsize: 10,
maxpoolsize: 100
};

 

 

This is the connection to the phoenix database and the queries are executed as below:

 

 

function phoenix() {
var jdbc = new JDBC(config);
let _this = this;
_this.conn = null;
// Initialize jdbc object
jdbc.initialize(function(err) {
if (err) {
console.log(new Date().toTimeString(), err);
}
});
jdbc.reserve(function(err, connObj) {
// The connection returned from the pool is an object with two fields
// {uuid: <uuid>, conn: <Connection>}
if (err) console.log(err);
if (connObj) {
_this.conn = connObj.conn;
const autoComm = false;
_this.conn.setAutoCommit(autoComm, function(err) {
if (err) {
console.log(new Date().toTimeString(), "error on setAutoCommit", err);
} else {
// console.log(new Date().toTimeString(), 'autoCommit is set to ', autoComm)
}
});
}
});
_this.query = function(sql) {
return new Promise((resolve, reject) => {
try {
_this.conn.createStatement(function(err, statement) {
if (err) {
reject(err);
} else {
statement.executeQuery(sql, function(err, resultset) {
if (err) {
reject(err);
} else {
resultset.toObjArray(function(errRes, results) {
if (errRes) reject(errRes);
else resolve(results);
});
}
});
}
});
} catch (e) {
reject(e);
}
});
};
}
module.exports = phoenix;

 

On the main page, we have 7 queries: The javascript needs to wait for each query to be executed before doing the next one. Each user has also to wait for the previous users queries before start showing results. The execution time is very high.

 

How can we do parallel processing of the queries ?

 

Thank you

Don't have an account?
Coming from Hortonworks? Activate your account here