???MapReduce???????????????
???????????? ???????[ 2013/11/7 10:10:59 ] ????????
???????????????????http request????????????????????????????
while(System.currentTimeMillis() - start <= runtime){
StringBuffer sb = new StringBuffer();
List<String> data = new ArrayList<String>();
HttpURLConnection httpurlconnection = null;
try{
URL url = new URL(this.reportAd);
httpurlconnection = (HttpURLConnection) url.openConnection();
httpurlconnection.setConnectTimeout(5000);
httpurlconnection.setReadTimeout(5000);
httpurlconnection.setDoOutput(true);
httpurlconnection.setRequestMethod("POST");
httpurlconnection.setRequestProperty("Content-type"?? "text/plain");
for(long i=0; i<this.recordnum; i++){
????????????
s = Math.abs(R.nextLong())%102400000+1024;
staticWriteSize += s;
reporter.incrCounter("TestTool"?? "Write Size"?? s);
staticWriteTime += (endTime - startTime);
reporter.incrCounter("TestTool"?? "Write Time"?? endTime - startTime);
????????????
}else{
????????????
reporter.incrCounter("TestTool"?? "Read Size"?? s);
staticReadTime += (endTime - startTime);
reporter.incrCounter("TestTool"?? "Read Time"?? endTime - startTime);
????????????
}
Pair p = value.get(R.nextInt(value.size()));
????????????
staticCount++;
}
reporter.incrCounter("TestTool"?? "Record num"?? this.recordnum);
reporter.setStatus("Record: "+staticCount+"("+staticWrite+"w?? "+staticRead+"r)?? Write Size: "
+staticWriteSize+"?? Write Time: "+staticWriteTime
+"?? Read Size: "+staticReadSize+"?? Read Time: "+staticReadTime);
httpurlconnection.getOutputStream().write(sb.toString().getBytes());
httpurlconnection.getOutputStream().flush();
httpurlconnection.getOutputStream().close();
int code = httpurlconnection.getResponseCode();
if(code != 200) {
LOG.warn("send data to master server failed?? code=" + code);
}
reporter.incrCounter("TestTool"?? "Http Post num"?? 1);
map.staticPost.addAndGet(1);
Thread.sleep(interval);
} catch (Exception e) {
map.staticPost.addAndGet(1);
reporter.incrCounter("TestTool"?? e.getClass().toString()?? 1);
LOG.warn(e.getMessage()?? e);
} finally {
if (httpurlconnection != null) {
httpurlconnection.disconnect();
}
}
???????????????????????????Mapper??????ù????????????????????????“org.apache.hadoop.mapred.Reporter”?????“incrCounter(Stringarg0?? String arg1?? long arg2)”????????е??????????????м??????÷?????????map/reduce task?л???arg0|arg1??????arg2?????????????MR??jobtracker???????????????????????????????Щ??????й?????????????????????“setStatus(String arg0)”???????÷????????????μ??????task??????????????????????task???????????jobdetails.jsp????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11