performance - The limitation when getting blob data from oracle -
performance - The limitation when getting blob data from oracle -
i trying download blob info oracle jdbc . in order know average response time of getting blob data, using jmeter phone call getting blob info java programme 1 or multiply threads.but got unusual response time not understand.
i tried tests below.(the blob info size 1m)
1.getting blob info jmeter in 1 thread
2.getting blob info jmeter in 2 thread
3.getting different blob info in same table jmeter in 2 thread
4.getting different blob info in different tables jmeter in 2 thread.
.from test 1 , 2,i found response time of test 2 twice of test 1 can not understand this(my server has 4 cores , nobody using that). uncertainty there lock when same blob info tried test 3. response time same test2.and tried test 4 create sure whether there lock when access same table,but response time of test 4 same test3.
i think oracle can create deal lot users' request @ same time,so cannot understand result got tests. oracle have limitation when getting blob info @ same time?
here code getting blob data
public sampleresult runtest(javasamplercontext arg0) { //// seek { class.forname(jdbc_class_name); conn=drivermanager.getconnection(jdbc_thin+dbserverip+":"+port+":"+sid,dbuser,userpwd); statement=conn.createstatement(); rs=statement.executequery(sqltext); responsestr=response_data_ok_head+kaigyou_code; if(rs.next()){ string fileid=rs.getstring(file_id_column_name); oracle.sql.blob blob=((oracleresultset)rs).getblob(blob_column_name); in=blob.getbinarystream(); int size=blob.getbuffersize(); byte[] buffer=new byte[size]; int len=-1; bos=new bytearrayoutputstream(); while((len=in.read(buffer))!=-1){ readcount=readcount+1; bos.write(buffer,0,len); } byte[] blobvalues=bos.tobytearray(); responsestr=responsestr+fileid+","+blobvalues.length+","+readcount+kaigyou_code; }else{ responsestr=response_data_zero; } } grab (exception e) { e.printstacktrace(); getngsampleresult(e,sr); homecoming sr; }finally{ seek { if(rs!=null){ rs.close(); rs=null; } if(statement!=null){ statement.close(); statement=null; } if(conn!=null){ conn.close(); conn=null; } if(in!=null){ in.close(); in=null; } if(bos!=null){ bos.close(); bos=null; } } grab (exception e) { e.printstacktrace(); getngsampleresult(e,sr); homecoming sr; } } sr.sampleend(); sr.setsuccessful(true); sr.setresponsecodeok(); sr.setresponsemessageok(); sr.setresponsedata(responsestr,"utf-8"); sr.setdatatype(sampleresult.text); homecoming sr; }
here test plan
<?xml version="1.0" encoding="utf-8"?> <jmetertestplan version="1.2" properties="2.1"> <hashtree> <testplan guiclass="testplangui" testclass="testplan" testname="test plan" enabled="true"> <stringprop name="testplan.comments"></stringprop> <boolprop name="testplan.functional_mode">false</boolprop> <boolprop name="testplan.serialize_threadgroups">false</boolprop> <elementprop name="testplan.user_defined_variables" elementtype="arguments" guiclass="argumentspanel" testclass="arguments" testname="user parameter" enabled="true"> <collectionprop name="arguments.arguments"> <elementprop name="env_test_date" elementtype="argument"> <stringprop name="argument.name">env_test_date</stringprop> <stringprop name="argument.value">20130202</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="env_test_case" elementtype="argument"> <stringprop name="argument.name">env_test_case</stringprop> <stringprop name="argument.value">run @ same time</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="env_test_filesize" elementtype="argument"> <stringprop name="argument.name">env_test_filesize</stringprop> <stringprop name="argument.value">1m</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="env_test_thread" elementtype="argument"> <stringprop name="argument.name">env_test_thread</stringprop> <stringprop name="argument.value">2users</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> </collectionprop> </elementprop> <stringprop name="testplan.user_define_classpath"></stringprop> </testplan> <hashtree> <threadgroup guiclass="threadgroupgui" testclass="threadgroup" testname="uldltest" enabled="true"> <stringprop name="threadgroup.on_sample_error">continue</stringprop> <elementprop name="threadgroup.main_controller" elementtype="loopcontroller" guiclass="loopcontrolpanel" testclass="loopcontroller" testname="loop controller" enabled="true"> <boolprop name="loopcontroller.continue_forever">false</boolprop> <intprop name="loopcontroller.loops">-1</intprop> </elementprop> <stringprop name="threadgroup.num_threads">2</stringprop> <stringprop name="threadgroup.ramp_time">1</stringprop> <longprop name="threadgroup.start_time">1358319600000</longprop> <longprop name="threadgroup.end_time">1358328499000</longprop> <boolprop name="threadgroup.scheduler">true</boolprop> <stringprop name="threadgroup.duration">300</stringprop> <stringprop name="threadgroup.delay"></stringprop> </threadgroup> <hashtree> <javasampler guiclass="javatestsamplergui" testclass="javasampler" testname="java dl blob request" enabled="true"> <elementprop name="arguments" elementtype="arguments" guiclass="argumentspanel" testclass="arguments" enabled="true"> <collectionprop name="arguments.arguments"> <elementprop name="sql_text" elementtype="argument"> <stringprop name="argument.name">sql_text</stringprop> <stringprop name="argument.value">select * t_download_file_data t t.file_id='testdata1m.csv'</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="db_user" elementtype="argument"> <stringprop name="argument.name">db_user</stringprop> <stringprop name="argument.value">xxxx</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="user_pwd" elementtype="argument"> <stringprop name="argument.name">user_pwd</stringprop> <stringprop name="argument.value">xxxx</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="sid" elementtype="argument"> <stringprop name="argument.name">sid</stringprop> <stringprop name="argument.value">xxxxx</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="dbserver_ip" elementtype="argument"> <stringprop name="argument.name">dbserver_ip</stringprop> <stringprop name="argument.value">xxx.xx.xx.xx</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> <elementprop name="port" elementtype="argument"> <stringprop name="argument.name">port</stringprop> <stringprop name="argument.value">1521</stringprop> <stringprop name="argument.metadata">=</stringprop> </elementprop> </collectionprop> </elementprop> <stringprop name="classname">sample.testsamplerclient</stringprop> </javasampler> <hashtree/> <resultcollector guiclass="tablevisualizer" testclass="resultcollector" testname="reust table" enabled="false"> <boolprop name="resultcollector.error_logging">false</boolprop> <objprop> <name>saveconfig</name> <value class="samplesaveconfiguration"> <time>true</time> <latency>true</latency> <timestamp>true</timestamp> <success>true</success> <label>true</label> <code>true</code> <message>true</message> <threadname>true</threadname> <datatype>true</datatype> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responsedata>false</responsedata> <samplerdata>false</samplerdata> <xml>true</xml> <fieldnames>false</fieldnames> <responseheaders>false</responseheaders> <requestheaders>false</requestheaders> <responsedataonerror>false</responsedataonerror> <saveassertionresultsfailuremessage>false</saveassertionresultsfailuremessage> <assertionsresultstosave>0</assertionsresultstosave> <bytes>true</bytes> </value> </objprop> <stringprop name="filename"></stringprop> </resultcollector> <hashtree/> <resultcollector guiclass="viewresultsfullvisualizer" testclass="resultcollector" testname="result graph" enabled="false"> <boolprop name="resultcollector.error_logging">false</boolprop> <objprop> <name>saveconfig</name> <value class="samplesaveconfiguration"> <time>true</time> <latency>true</latency> <timestamp>true</timestamp> <success>true</success> <label>true</label> <code>true</code> <message>true</message> <threadname>true</threadname> <datatype>true</datatype> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responsedata>false</responsedata> <samplerdata>false</samplerdata> <xml>true</xml> <fieldnames>false</fieldnames> <responseheaders>false</responseheaders> <requestheaders>false</requestheaders> <responsedataonerror>false</responsedataonerror> <saveassertionresultsfailuremessage>false</saveassertionresultsfailuremessage> <assertionsresultstosave>0</assertionsresultstosave> <bytes>true</bytes> </value> </objprop> <stringprop name="filename"></stringprop> </resultcollector> <hashtree/> <resultcollector guiclass="statvisualizer" testclass="resultcollector" testname="report" enabled="true"> <boolprop name="resultcollector.error_logging">false</boolprop> <objprop> <name>saveconfig</name> <value class="samplesaveconfiguration"> <time>true</time> <latency>true</latency> <timestamp>true</timestamp> <success>true</success> <label>true</label> <code>true</code> <message>true</message> <threadname>true</threadname> <datatype>true</datatype> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responsedata>false</responsedata> <samplerdata>false</samplerdata> <xml>true</xml> <fieldnames>false</fieldnames> <responseheaders>false</responseheaders> <requestheaders>false</requestheaders> <responsedataonerror>false</responsedataonerror> <saveassertionresultsfailuremessage>false</saveassertionresultsfailuremessage> <assertionsresultstosave>0</assertionsresultstosave> <bytes>true</bytes> </value> </objprop> <stringprop name="filename">log\uldlperformance_${env_test_case}_${env_test_thread}_${env_test_filesize}_${env_test_date}.jtl</stringprop> </resultcollector> <hashtree/> </hashtree> </hashtree> </hashtree> </jmetertestplan>
as coded measuring : - connection db - blob read - connection close
you maybe utilize jdbc configuration element:
http://jmeter.apache.org/usermanual/component_reference.html#jdbc_connection_configuration
so connection established before sample.
then modify code looking @ how jdbc request works access db connection:
conn = datasourceelement.getconnection("variable name used in jdbc_connection_configuration");
performance oracle blob jmeter
Comments
Post a Comment