performance - apache phoenix, slow write speed when change currentSCN -
have old hbase table (billion records) , need use data create new phoenix table. want preserve record modtime old record. based on phoenix suggestion. give property currentscn when connect. seems slow. while doc
keep in mind creating new connection not expensive operation. same underlying hconnection used connections same cluster, it’s more or less instantiating few objects.
i test using simple program.
class.forname("org.apache.phoenix.jdbc.phoenixdriver"); int x = 0; for(int i=1000000 ;i< 2000000;i++ ) { properties prop = new properties(); prop.setproperty("currentscn",string.valueof(i)); connection con = drivermanager.getconnection("jdbc:phoenix:a1.cluster",prop); con.setautocommit(false); preparedstatement stmt2 = con.preparestatement("upsert fff values (?,?,?,?,?)"); stmt2.setstring(1,string.valueof(i)); stmt2.settimestamp(2, timestamp.from(instant.ofepochmilli(system.currenttimemillis()))); stmt2.setstring(3, null); stmt2.setdouble(4, double.valueof(i)); stmt2.setstring(5, null); stmt2.execute(); x=x+1; if(x % 1000==0) system.out.println("-----------"+x);
a profiling suggest 90% time spend on getconnection , 10% spend on execute. on single machine, insert speed around 1000 record/s without commit, think very slow. how improve upsert speed in case?
Comments
Post a Comment