Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
9abaa20d
Commit
9abaa20d
authored
Aug 17, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the babeld configuration now allows /128 subnets
parent
f098a0c4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
6075 deletions
+104
-6075
TODO
TODO
+0
-4
re6st/plib.py
re6st/plib.py
+4
-2
re6st/tunnel.py
re6st/tunnel.py
+2
-2
simulation/realistic_dataset/data/refresh1/out_0.csv
simulation/realistic_dataset/data/refresh1/out_0.csv
+0
-3000
simulation/realistic_dataset/data/refresh1/out_1.csv
simulation/realistic_dataset/data/refresh1/out_1.csv
+0
-3000
simulation/realistic_dataset/graph.cpp
simulation/realistic_dataset/graph.cpp
+43
-50
simulation/realistic_dataset/latency.cpp
simulation/realistic_dataset/latency.cpp
+9
-0
simulation/realistic_dataset/main.cpp
simulation/realistic_dataset/main.cpp
+41
-14
simulation/realistic_dataset/main.h
simulation/realistic_dataset/main.h
+5
-3
No files found.
TODO
View file @
9abaa20d
...
...
@@ -17,7 +17,3 @@ To be done :
Put a section about how to build the package from the sources in the README
http://pdos.csail.mit.edu/p2psim/kingdata/
http://www.eecs.harvard.edu/~syrah/nc/king/lats.n8.gz
http://www.cs.cornell.edu/People/egs/meridian/data.php
re6st/plib.py
View file @
9abaa20d
...
...
@@ -66,12 +66,14 @@ def router(network, subnet, subnet_size, interface_list,
wireless
,
hello_interval
,
state_path
,
**
kw
):
logging
.
info
(
'Starting babel...'
)
args
=
[
'babeld'
,
'-C'
,
'redistribute local ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'redistribute local ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'redistribute local deny'
,
'-C'
,
'redistribute ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'redistribute deny'
,
'-C'
,
'out local ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'out local deny'
,
# Route VIFIB ip adresses
'-C'
,
'in ip %s::/%u
le 127
'
%
(
utils
.
ipFromBin
(
network
),
len
(
network
)),
'-C'
,
'in ip %s::/%u'
%
(
utils
.
ipFromBin
(
network
),
len
(
network
)),
# Route only addresse in the 'local' network,
# or other entire networks
#'-C', 'in ip %s' % (config.internal_ip),
...
...
re6st/tunnel.py
View file @
9abaa20d
...
...
@@ -151,7 +151,7 @@ class TunnelManager:
if
not
self
.
_fast_start_done
and
len
(
possiblePeers
)
>
4
:
nSend
=
min
(
self
.
_peer_db
.
db_size
,
len
(
possiblePeers
))
else
:
nSend
=
min
(
4
,
len
(
possiblePeers
))
nSend
=
min
(
2
,
len
(
possiblePeers
))
for
ip
in
random
.
sample
(
possiblePeers
,
nSend
):
self
.
_notifyPeer
(
ip
)
...
...
@@ -179,7 +179,7 @@ class TunnelManager:
ip
=
'%s:%s:%s:%s:%s:%s:%s:%s'
%
(
peerIp
[
0
:
4
],
peerIp
[
4
:
8
],
peerIp
[
8
:
12
],
peerIp
[
12
:
16
],
peerIp
[
16
:
20
],
peerIp
[
20
:
24
],
peerIp
[
24
:
28
],
peerIp
[
28
:
32
])
logging
.
trace
(
'Notifying peer %s'
%
ip
)
self
.
peer_db
.
sock
.
sendto
(
'%s %s
\
n
'
%
(
self
.
_prefix
,
utils
.
address_str
(
self
.
_peer_db
.
address
)),
(
ip
,
326
))
self
.
_
peer_db
.
sock
.
sendto
(
'%s %s
\
n
'
%
(
self
.
_prefix
,
utils
.
address_str
(
self
.
_peer_db
.
address
)),
(
ip
,
326
))
except
socket
.
error
,
e
:
logging
.
debug
(
'Unable to notify %s'
%
ip
)
logging
.
debug
(
'socket.error : %s'
%
e
)
simulation/realistic_dataset/data/refresh1/out_0.csv
deleted
100644 → 0
View file @
f098a0c4
This diff is collapsed.
Click to expand it.
simulation/realistic_dataset/data/refresh1/out_1.csv
deleted
100644 → 0
View file @
f098a0c4
This diff is collapsed.
Click to expand it.
simulation/realistic_dataset/graph.cpp
View file @
9abaa20d
...
...
@@ -110,56 +110,6 @@ void Graph::GetRoutesFrom(int from, int* nRoutes, int* prevs, int* distances)
}
}
void
Graph
::
GetRoutesFromHop
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
)
{
// init vars
stack
<
int
>
order
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
distances
[
i
]
=
-
1
;
nRoutes
[
i
]
=
1
;
}
distances
[
from
]
=
0
;
priority_queue
<
pair
<
int
,
int
>>
remainingNodes
;
remainingNodes
.
push
(
pair
<
int
,
int
>
(
-
0
,
from
));
// Get the order
while
(
!
remainingNodes
.
empty
())
{
pair
<
int
,
int
>
p
=
remainingNodes
.
top
();
int
node
=
p
.
second
;
int
d
=
-
p
.
first
;
remainingNodes
.
pop
();
if
(
d
==
distances
[
node
])
{
order
.
push
(
node
);
for
(
int
neighbor
:
adjacency
[
node
])
{
int
neighborDist
=
d
+
1
;
if
(
distances
[
neighbor
]
==
-
1
||
distances
[
neighbor
]
>
neighborDist
)
{
distances
[
neighbor
]
=
neighborDist
;
prevs
[
neighbor
]
=
node
;
remainingNodes
.
push
(
pair
<
int
,
int
>
(
-
neighborDist
,
neighbor
));
}
}
}
}
// get the BC
while
(
!
order
.
empty
())
{
int
node
=
order
.
top
();
order
.
pop
();
if
(
distances
[
node
]
!=
-
1
&&
node
!=
from
)
nRoutes
[
prevs
[
node
]]
+=
nRoutes
[
node
];
}
}
routesResult
Graph
::
GetRouteResult
(
int
node
,
int
nRefresh
,
double
*
bc
)
{
int
nRoutes
[
size
],
prevs
[
size
],
distances
[
size
];
...
...
@@ -414,4 +364,47 @@ void Graph::GetArity(int* arity)
for
(
int
i
=
0
;
i
<
size
;
i
++
)
arity
[
adjacency
[
i
].
size
()]
++
;
}
void
Graph
::
GetArityLat
(
int
arity
[][
10
])
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
a
=
0
;
a
<=
maxPeers
;
a
++
)
arity
[
a
][
i
]
=
0
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
arity
[
adjacency
[
i
].
size
()][
max
(
min
((
int
)(
latency
->
avgLatencyToOthers
[
i
]
-
45000
)
/
5000
,
9
),
0
)]
++
;
}
double
Graph
::
GetAvgDistanceHop
()
{
double
avgDist
=
0
;
int
distances
[
size
];
for
(
int
from
=
0
;
from
<
size
;
from
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
distances
[
i
]
=
-
1
;
distances
[
from
]
=
0
;
queue
<
int
>
remainingNodes
;
remainingNodes
.
push
(
from
);
// Get the order
while
(
!
remainingNodes
.
empty
())
{
int
node
=
remainingNodes
.
front
();
remainingNodes
.
pop
();
avgDist
+=
distances
[
node
];
for
(
int
neighbor
:
adjacency
[
node
])
if
(
distances
[
neighbor
]
==
-
1
)
{
distances
[
neighbor
]
=
distances
[
node
]
+
latency
->
values
[
neighbor
][
node
];
remainingNodes
.
push
(
neighbor
);
}
}
}
return
avgDist
/
(
size
*
size
);
}
\ No newline at end of file
simulation/realistic_dataset/latency.cpp
View file @
9abaa20d
...
...
@@ -3,6 +3,7 @@
Latency
::
Latency
(
const
char
*
filePath
,
int
size
)
:
size
(
size
)
{
values
=
new
int
*
[
size
];
avgLatencyToOthers
=
new
double
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
values
[
i
]
=
new
int
[
size
];
...
...
@@ -26,6 +27,14 @@ Latency::Latency(const char* filePath, int size) : size(size)
values
[
a
-
1
][
b
-
1
]
=
latency
;
}
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
avgLatencyToOthers
[
i
]
=
0
;
for
(
int
j
=
0
;
j
<
size
;
j
++
)
avgLatencyToOthers
[
i
]
+=
values
[
i
][
j
];
avgLatencyToOthers
[
i
]
/=
size
;
}
fclose
(
file
);
}
...
...
simulation/realistic_dataset/main.cpp
View file @
9abaa20d
// To compile : g++ -std=c++0x latency.cpp graph.cpp main.cpp -lpthread
// The best distance for latency : 66.9239 with a full graph
// other dataset : http://pdos.csail.mit.edu/p2psim/kingdata/
// for latency_2 :
// Optimal distance : 16085.3
...
...
@@ -14,6 +13,9 @@ void simulate(int size, int k, int maxPeer, int seed, Latency* latency, const ch
FILE
*
output
=
fopen
(
outName
,
"wt"
);
int
fno
=
fileno
(
output
);
double
nRoutesKilled
=
0
;
int
arityLatDistrib
[
maxPeer
+
1
][
10
];
double
avgDistance
,
unreachable
;
double
arityDistrib
[
31
],
bcArity
[
31
];
Graph
graph
(
size
,
k
,
maxPeer
,
rng
,
latency
);
...
...
@@ -32,16 +34,23 @@ void simulate(int size, int k, int maxPeer, int seed, Latency* latency, const ch
}*/
double
avgDistance
,
unreachable
;
double
arityDistrib
[
31
],
bcArity
[
31
];
graph
.
Reboot
(
1.0
/
(
100
+
1.0
),
i
);
//graph.Reboot(1.0/(100 + 1.0), i);
graph
.
UpdateLowRoutes
(
avgDistance
,
unreachable
,
nRoutesKilled
,
arityDistrib
,
bcArity
,
1
,
i
);
graph
.
GetArityLat
(
arityLatDistrib
);
fprintf
(
output
,
"%d,%f,%f"
,
i
,
avgDistance
,
nRoutesKilled
);
for
(
int
j
=
0
;
j
<=
30
;
j
++
)
fprintf
(
output
,
"%d,%f,%f
,A
"
,
i
,
avgDistance
,
nRoutesKilled
);
for
(
int
j
=
k
;
j
<=
30
;
j
++
)
fprintf
(
output
,
",%f"
,
arityDistrib
[
j
]);
for
(
int
j
=
0
;
j
<=
30
;
j
++
)
fprintf
(
output
,
",B"
);
for
(
int
j
=
k
;
j
<=
30
;
j
++
)
fprintf
(
output
,
",%f"
,
bcArity
[
j
]);
for
(
int
j
=
0
;
j
<
10
;
j
++
)
{
fprintf
(
output
,
",L%d"
,
j
);
for
(
int
a
=
k
;
a
<=
maxPeer
;
a
++
)
fprintf
(
output
,
",%d"
,
arityLatDistrib
[
a
][
j
]);
}
fprintf
(
output
,
"
\n
"
);
fflush
(
output
);
fsync
(
fno
);
...
...
@@ -181,11 +190,29 @@ void Optimize(int size, int k, int maxPeer, int seed, Latency* latency, const ch
cout
<<
endl
;
}
string
computeDist
(
int
size
,
int
k
,
int
maxPeer
,
int
seed
,
Latency
*
latency
)
{
mt19937
rng
(
seed
);
Graph
graph
(
size
,
k
,
maxPeer
,
rng
,
latency
);
double
avgDistLatency
=
0
;
int
nRoutes
[
size
],
prevs
[
size
],
distances
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
graph
.
GetRoutesFrom
(
i
,
nRoutes
,
prevs
,
distances
);
for
(
int
j
=
0
;
j
<
size
;
j
++
)
avgDistLatency
+=
distances
[
j
];
}
ostringstream
out
;
out
<<
avgDistLatency
/
(
size
*
size
)
<<
","
<<
graph
.
GetAvgDistanceHop
()
<<
endl
;
return
out
.
str
();
}
int
main
(
int
argc
,
char
**
argv
)
{
mt19937
rng
(
time
(
NULL
));
//Latency latencyR("latency/pw-1715/pw-1715-latencies", 1715);
//latencyR.Rewrite(20);
Latency
*
latency
=
new
Latency
(
"datasets/latency_2_2500"
,
2500
);
//cout << "Optimal distance : " << latency->GetAverageDistance() << endl;
...
...
@@ -193,19 +220,19 @@ int main(int argc, char** argv)
vector
<
future
<
void
>>
threads
;
/*
for(int i=0; i<1; i++)
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
int
seed
=
rng
();
char
*
out
=
new
char
[
100
];
sprintf(out, "
test_optimized
_%d.csv", i);
sprintf
(
out
,
"
out
_%d.csv"
,
i
);
threads
.
push_back
(
async
(
launch
::
async
,
[
seed
,
out
,
latency
]()
{
testOptimized
(2500, 10, 30, seed, latency, out); delete[] out; }));
{
simulate
(
2500
,
10
,
30
,
seed
,
latency
,
out
);
delete
[]
out
;
}));
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
threads[i].get();
*/
threads
[
i
].
get
();
Optimize
(
2500
,
10
,
30
,
rng
(),
latency
,
"out.csv"
);
//
Optimize(2500, 10, 30, rng(), latency, "out.csv");
delete
latency
;
return
0
;
...
...
simulation/realistic_dataset/main.h
View file @
9abaa20d
...
...
@@ -29,6 +29,7 @@ public:
double
GetAverageDistance
();
double
GetAveragePing
();
int
**
values
;
double
*
avgLatencyToOthers
;
private:
int
size
;
...
...
@@ -46,13 +47,14 @@ public:
void
KillMachines
(
float
proportion
);
pair
<
double
,
double
>
UpdateLowRoutesArity
(
int
arityToUpdate
);
void
GetArity
(
int
*
arity
);
void
GetRoutesFromHop
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
)
void
GetRoutesFrom
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
);
double
GetAvgDistanceHop
();
void
GetArityLat
(
int
arity
[][
10
]);
private:
void
SaturateNode
(
int
node
);
bool
AddEdge
(
int
from
);
void
RemoveEdge
(
int
from
,
int
to
);
void
GetRoutesFrom
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
);
int
CountUnreachableFrom
(
int
node
);
routesResult
GetRouteResult
(
int
node
,
int
nRefresh
,
double
*
bc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment