1. delete unuseful files
2. change the dbcfg's location 3. bug fix
This commit is contained in:
parent
36ff0648ec
commit
5c799917e9
|
@ -0,0 +1 @@
|
|||
replicasNum = 4
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -22,7 +22,7 @@
|
|||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>experience.jsp</welcome-file>
|
||||
<welcome-file>overview.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -408,5 +408,9 @@ margin-left: 0;
|
|||
font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.myp {
|
||||
display:block;
|
||||
text-align:justify;
|
||||
text-indent:30px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<body onLoad="initAjax()">
|
||||
<div class="gridContainer clearfix">
|
||||
<div class="fluid top" id="top">
|
||||
<div class="fluid toptitle"><a href="#">R-Memcached Demo</a></div>
|
||||
<div class="fluid toptitle"><a href="overview.jsp">R-Memcached Demo</a></div>
|
||||
<div class="fluid topmenu">
|
||||
<div class="fluid menuitem" id="overview"><a href="overview.jsp">Overview</a></div>
|
||||
<div class="fluid menuitem" id="experience"><a href="experience.jsp">Experience</a></div>
|
||||
|
@ -170,10 +170,6 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
}
|
||||
function reset(){
|
||||
document.location.reload();
|
||||
$('#chart1-1').html('');
|
||||
$('#chart1-2').html('');
|
||||
$('#chart2').html('');
|
||||
$('#chart3').html('');
|
||||
}
|
||||
function setprogress(count1, count2){
|
||||
var para1 = document.getElementById("para1").value;
|
||||
|
@ -193,6 +189,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
function showInfo(){
|
||||
status = true;
|
||||
progresslength1 = 0;
|
||||
progresslength2 = 0;
|
||||
resultlist = new Array();
|
||||
document.getElementById("resultarea1").value="";
|
||||
document.getElementById("processbar1").style.width ='0px';
|
||||
|
@ -202,6 +199,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
$('#time1').text("0.000");
|
||||
$("#progresslabel2").text("0%");
|
||||
$('#time2').text("0.000");
|
||||
showBar();
|
||||
|
||||
var para1 = document.getElementById("para1").value;
|
||||
threads = para1*1;
|
||||
|
@ -391,12 +389,16 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
title:'R-Memcached VS Asfmemcached',
|
||||
seriesDefaults: {
|
||||
pointLabels: {show: true},
|
||||
shadow: false,showMarker: true,
|
||||
shadow: false,
|
||||
showMarker: true,
|
||||
renderer: $.jqplot.BarRenderer,
|
||||
rendererOptions: {
|
||||
barDirection: 'horizontal', barWidth: 60, barMargin:50
|
||||
}
|
||||
},
|
||||
markerOptions: {
|
||||
show: true
|
||||
},
|
||||
axes: {
|
||||
yaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
|
@ -424,6 +426,9 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
barDirection: 'horizontal', barWidth: 60, barMargin:50
|
||||
}
|
||||
},
|
||||
markerOptions: {
|
||||
show: true
|
||||
},
|
||||
axes: {
|
||||
yaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
|
@ -448,7 +453,11 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
pointLabels: {show: true},
|
||||
shadow: false,showMarker: true,
|
||||
renderer: $.jqplot.BarRenderer,
|
||||
rendererOptions: {barWidth: 30,barMargin: 50}},
|
||||
rendererOptions: {barWidth: 30,barMargin: 50}
|
||||
},
|
||||
markerOptions: {
|
||||
show: true
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
|
@ -476,7 +485,11 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
pointLabels: {show: true},
|
||||
shadow: false,showMarker: true,
|
||||
renderer: $.jqplot.BarRenderer,
|
||||
rendererOptions: {barWidth: 30,barMargin: 50}},
|
||||
rendererOptions: {barWidth: 30,barMargin: 50}
|
||||
},
|
||||
markerOptions: {
|
||||
show: true
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
|
|
|
@ -9,7 +9,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<head>
|
||||
<!-- <base href="<%=basePath%>">-->
|
||||
|
||||
<title>R-Memcached-experience</title>
|
||||
<title>R-Memcached-overview</title>
|
||||
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
|
@ -27,7 +27,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<body>
|
||||
<div class="gridContainer clearfix">
|
||||
<div class="fluid top" id="top">
|
||||
<div class="fluid toptitle"><a href="#">R-Memcached Demo</a></div>
|
||||
<div class="fluid toptitle"><a href="overview.jsp">R-Memcached Demo</a></div>
|
||||
<div class="fluid topmenu">
|
||||
<div class="fluid menuitem" id="overview"><a href="overview.jsp">Overview</a></div>
|
||||
<div class="fluid menuitem" id="experience"><a href="experience.jsp">Experience</a></div>
|
||||
|
@ -36,28 +36,20 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
</div>
|
||||
|
||||
<div class="fluid middle">
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Overview</div>
|
||||
<div class="introduce" style="height:274px;">
|
||||
<p> In this work we aim at designing a distributed caching middleware, R-Memcached, which can save multiple replicas of data in different nodes to prevent a large number of concurrent requests from sending to a single node.
|
||||
</p>
|
||||
<p> It can deal with the single point failure and hotspot issues. R-Memcached is based on asfmemecached open-source Memcached client. We first design and implement a consistent hashing to organize the Memcached severs and the placement of data replicas. Second, replicas consistency is our major concern. For different application scenarios, R-Memcached support three different protocols including 2-PC (two phase commit), Paxos and eventual consistency. Third, we design the read/write strategies corresponding to the three consistency protocols. Fourth, we incorporate non-block IO and Google's protocol buffer to optimize the communication efficiency between clients and Memcached servers.
|
||||
</p>
|
||||
<p> Experiments show that, compared with asfmemcached, the maximum throughput of R-Memcached increases by 2~3x when we cached 4 copies per data.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Structure</div>
|
||||
<div class="introduce" style="text-align:center; height:880px;">
|
||||
<div class="introduce" style="text-align:center; height:930px;">
|
||||
<div style="width:100%; height:80px; text-align:left;"><p class="myp">
|
||||
In this work we aim at designing a distributed caching middleware, R-Memcached, which can save multiple replicas of data in different nodes to prevent a large number of concurrent requests from sending to a single node. It can deal with the single point failure and hotspot issues.</p>
|
||||
</div>
|
||||
<img alt="" src="data/images/struct.png" style="height:800px; margin-top:20px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Hashing in R-Memcached</div>
|
||||
<div class="introduce" style="text-align:center; height:550px;">
|
||||
<div style="width:100%; height:180px; text-align:left;"><p>
|
||||
we design a special consistent hashing in R-Memcached. Each R-Memcached maintains the same global hash table that records where the replicas are. Consistent hashing maps both the objects and the cache nodes to a ring, as shown in Figure 2. As we see, those large circles represent cache nodes, and the small circle represents the data requested by users. We can determine where data is stored based on those big circles in a clockwise direction. For example, the number of replicas is 3, object1 must be stored in nodes A, B and C. This hashing support nodes' dynamic addition or deletion. When it adds a cache node D in Figure 3, by the method of looking up nodes clockwise, the object1 should be stored in nodes A, B and D, and object1 in nodes A, B doesn't need to be transferred. Hence, this hashing can cut down the transferred data by a large degree. In the same way, the deletion of any node will not have severe impact on the system.
|
||||
<div class="introduce" style="text-align:center; height:430px;">
|
||||
<div style="width:100%; height:80px; text-align:left;"><p class="myp">
|
||||
We design a special consistent hashing in R-Memcached. Each R-Memcached maintains the same global hash table that records where the replicas are. Consistent hashing maps both the objects and the cache nodes to a ring. It support nodes' dynamic addition or deletion, reduce the transferred data by a large degree.
|
||||
</p></div>
|
||||
<img alt="" src="data/images/figure5.png" style="height:320px; margin-top:20px;">
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<head>
|
||||
<!-- <base href="<%=basePath%>">-->
|
||||
|
||||
<title>R-Memcached-experience</title>
|
||||
<title>R-Memcached-testdata</title>
|
||||
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
|
@ -27,7 +27,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<body>
|
||||
<div class="gridContainer clearfix">
|
||||
<div class="fluid top" id="top">
|
||||
<div class="fluid toptitle"><a href="#">R-Memcached Demo</a></div>
|
||||
<div class="fluid toptitle"><a href="overview.jsp">R-Memcached Demo</a></div>
|
||||
<div class="fluid topmenu">
|
||||
<div class="fluid menuitem" id="overview"><a href="overview.jsp">Overview</a></div>
|
||||
<div class="fluid menuitem" id="experience"><a href="experience.jsp">Experience</a></div>
|
||||
|
@ -42,18 +42,12 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
|
|||
<video src="" controls="controls" style="height:518px;width:100%;margin-top:8px;">
|
||||
</div>
|
||||
</div-->
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Overview</div>
|
||||
<div class="introduce" style="height:174px;">
|
||||
<p> The evaluation has been performed in a cluster of 10 machines connected through a 100 Mbps switch. Each has 4GB of RAM, Intel(R) 82567LM-3 Gigabit Network Connection. The operating system in 10 machines is Debian 6.
|
||||
The purpose of this experiment is to compare the read and write performance between R-Memcached and traditional Memcached clients (such as spymemcached, asfmemcached, repcached), and display the advantages and disadvantages of R-Memcached. We assume that each data caches 4 replicas. The test scheme is shown as follows:
|
||||
1) Test throughput of R-Memcached and traditional Memcached clients under the different workloads, i.e. the number of threads is 1, 10, 50, 100, 500, 1000, and 2000. Each thread sends 1000 requests. Based on the different proportion of read and write, tests are divided into five scenario: read-only, write-only, 95% read and 5% write, 80% read and 20% write, and 50% read and 50% write.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Test Data</div>
|
||||
<div class="introduce" style="text-align:center; height:2160px;">
|
||||
<div class="introduce" style="text-align:center; height:2240px;">
|
||||
<div style="width:100%; height:125px; text-align:left;"><p class="myp">
|
||||
The evaluation has been performed in a cluster of 4 machines connected through a 100 Mbps switch. Each has 4GB of RAM, Intel(R) 82567LM-3 Gigabit Network Connection. The operating system in 4 machines is Debian 6. Test throughput of R-Memcached and traditional Memcached clients under the different workloads, i.e. the number of threads is 1, 10, 50, 100, 500, 1000, and 2000. Each thread sends 1000 requests. Based on the different proportion of read and write, tests are divided into five scenario: read-only, write-only, 95% read and 5% write, 80% read and 20% write, and 50% read and 50% write.
|
||||
</p></div>
|
||||
<img alt="" src="data/images/figure7.png" style="height:400px; margin-top:20px; margin-right:30px;">
|
||||
<img alt="" src="data/images/figure8.png" style="height:400px; margin-top:20px; margin-left:30px;">
|
||||
<img alt="" src="data/images/figure9.png" style="height:400px; margin-top:20px; margin-right:30px;">
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<!-- <base href="<%=basePath%>">-->
|
||||
|
||||
<title>R-Memcached-experience</title>
|
||||
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
|
||||
<meta http-equiv="description" content="This is my page">
|
||||
|
||||
<link href="css/boilerplate.css" rel="stylesheet" type="text/css">
|
||||
<link href="css/memcache.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<script type="text/javascript" src="scripts/jquery-1.3.2.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){showBar();});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="initAjax()">
|
||||
<div class="gridContainer clearfix">
|
||||
<div class="fluid top" id="top">
|
||||
<div class="fluid toptitle"><a href="#">R-Memcached Demo</a></div>
|
||||
<div class="fluid topmenu">
|
||||
<div class="fluid menuitem" id="welcome"><a href="welcome.jsp">Welcome</a></div>
|
||||
<div class="fluid menuitem" id="experience"><a href="experience.jsp">Experience</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fluid middle">
|
||||
<div class="fluid exp">
|
||||
<div class="fluid title1">How to Use?</div>
|
||||
<div class="expout" style="background:black;">
|
||||
<video src="" controls="controls" style="height:518px;width:100%;margin-top:8px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Structure</div>
|
||||
<div class="introduce" style="text-align:center;">
|
||||
<img alt="" src="data/intro.png" style="height:320px; width:90%; margin-top:20px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="fluid result">
|
||||
<div class="fluid title1">Introduction</div>
|
||||
<div class="introduce">
|
||||
<h3 style="padding:0px; margin:2px">基本说明</h3>
|
||||
R-Memcached是基于Memcached的Java客户端的改进,通过添加副本机制均衡负载。
|
||||
<h3 style="padding:0px; margin:2px">主要功能</h3>
|
||||
R-Memcached的主要功能是
|
||||
<h3 style="padding:0px; margin:2px">创新点</h3>
|
||||
R-Memcached的主要创新点是
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fluid bottom">
|
||||
<p>R-Memcached@ACT.BUAA</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script language="JavaScript">
|
||||
|
||||
</script>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
url = jdbc:mysql://192.168.3.218:3306/tpcw
|
||||
username = root
|
||||
password = 1234
|
||||
sqlget = select c_id, c_uname, c_passwd, c_birthdate from customer where c_id = ?
|
||||
sqlset = replace into customer(c_id, c_birthdaye) values(?, ?)
|
|
@ -0,0 +1 @@
|
|||
replicasNum = 4
|
|
@ -9,6 +9,7 @@ import java.util.Random;
|
|||
|
||||
import com.meetup.memcached.*;
|
||||
import com.myself.database.DatabaseCon;
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
@ -30,7 +31,7 @@ public class MemcachedServer {
|
|||
private static final int RESULTTHROLD = 1000;
|
||||
|
||||
public static void main(String[] args) {
|
||||
MemcachedServer.run(new String[]{"100","1000","0","64","0.8"});
|
||||
MemcachedServer.run(new String[]{"100","1000","1","64","0.8"});
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -75,11 +76,7 @@ public class MemcachedServer {
|
|||
}
|
||||
|
||||
oldStats = getStats();
|
||||
if (args.length == 5) {
|
||||
DatabaseCon.getInstance().start();
|
||||
} else {
|
||||
DatabaseCon.getInstance().start(ORIGINPATH);
|
||||
}
|
||||
DatabaseCon.getInstance().start(ORIGINPATH);
|
||||
MemcachedServer.initFlag = true;
|
||||
|
||||
for (int i = 0; i < threads; i++) {
|
||||
|
@ -98,6 +95,7 @@ public class MemcachedServer {
|
|||
System.out.println(nodeStats);
|
||||
|
||||
time = time/threads;
|
||||
System.err.println(time / 1000000000.0f);
|
||||
initFlag = false;
|
||||
System.out.println("requestNumber: " + results.length());
|
||||
recycle();
|
||||
|
@ -213,6 +211,11 @@ public class MemcachedServer {
|
|||
else {
|
||||
aResult.put("value", (String) out);
|
||||
}
|
||||
// String value = DatabaseCon.getInstance().queryKey(keyword);
|
||||
// if (value == null){
|
||||
// value = object;
|
||||
// }
|
||||
// mc.set(keyword, value);
|
||||
k ++;
|
||||
} else {
|
||||
String keyword = keys[randNum.nextInt(nums)];
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
package dao;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
|
@ -27,6 +29,8 @@ import org.xml.sax.SAXException;
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
import com.myself.database.DatabaseCon;
|
||||
import com.myself.memcached.MemcachedMgr;
|
||||
import com.myself.server.ClientConfig;
|
||||
|
@ -127,11 +131,7 @@ public class RMemcachedServer {
|
|||
}
|
||||
|
||||
getStats();
|
||||
if (args.length == 5) {
|
||||
DatabaseCon.getInstance().start();
|
||||
} else {
|
||||
DatabaseCon.getInstance().start(ORIGINPATH);
|
||||
}
|
||||
DatabaseCon.getInstance().start(ORIGINPATH);
|
||||
RMemcachedServer.initFlag = true;
|
||||
|
||||
for (int i = 0; i < threads; i++) {
|
||||
|
@ -158,6 +158,7 @@ public class RMemcachedServer {
|
|||
System.out.println(nodeStats);
|
||||
|
||||
time = time/threads;
|
||||
System.err.println(time / 1000000000.0f);
|
||||
status = true;
|
||||
requestServer.stop();
|
||||
RMemcachedServer.initFlag = false;
|
||||
|
@ -231,6 +232,14 @@ public class RMemcachedServer {
|
|||
}
|
||||
|
||||
public static boolean initConfig() {
|
||||
try {
|
||||
Properties properties = new Properties();
|
||||
properties.load(new FileInputStream(ORIGINPATH+"config.properties"));
|
||||
MemcachedMgr.nCopyNode = Integer.parseInt(properties.getProperty("replicasNum"));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (m_mapMemcachedClient != null && m_mapMemcachedClient.size() >0 ){
|
||||
return true;
|
||||
}
|
||||
|
@ -299,6 +308,7 @@ public class RMemcachedServer {
|
|||
// }
|
||||
// }).start();
|
||||
// }
|
||||
|
||||
// String value = DatabaseCon.getInstance().queryKey(keyword);
|
||||
// if (value == null) {
|
||||
// value = object;
|
||||
|
|
Loading…
Reference in New Issue