Skip to content

Commit

Permalink
Check in cops results
Browse files Browse the repository at this point in the history
  • Loading branch information
sgdxbc committed Apr 19, 2024
1 parent d89df99 commit 3ab73f2
Show file tree
Hide file tree
Showing 24 changed files with 350 additions and 35 deletions.
5 changes: 5 additions & 0 deletions src/bin/boson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ use tracing::warn;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();
let mut rlimit = rustix::process::getrlimit(rustix::process::Resource::Nofile);
if rlimit.current.is_some() && rlimit.current < rlimit.maximum {
rlimit.current = rlimit.maximum;
rustix::process::setrlimit(rustix::process::Resource::Nofile, rlimit)?
}
let app = Router::new()
.route("/ok", get(ok))
.route("/mutex/start", post(mutex_start))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/boson_cops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub async fn pbft_client_session(
// let tcp_listener = TcpListener::bind((ip, 0)).await?;
let tcp_listener = TcpListener::bind(SocketAddr::from(([0; 4], 0))).await?;
let addr = SocketAddr::from((ip, tcp_listener.local_addr()?.port()));
println!("client {addr} listening {:?}", tcp_listener.local_addr());
// println!("client {addr} listening {:?}", tcp_listener.local_addr());
let workload = create_workload(
StdRng::seed_from_u64(117418 + index as u64),
index < num_concurrent_put,
Expand Down
30 changes: 15 additions & 15 deletions src/cops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ impl<N, U: SendEvent<InvokeOk<ycsb::Result>>, V: Version, A> OnEvent<Recv<PutOk<
let Some((key, timer_id)) = self.working_key.take() else {
anyhow::bail!("missing working key")
};
if !self.deps.values().all(|dep| {
matches!(
put_ok.version_deps.partial_cmp(dep),
Some(Ordering::Greater)
)
}) {
return Ok(());
}
// if !self.deps.values().all(|dep| {
// matches!(
// put_ok.version_deps.partial_cmp(dep),
// Some(Ordering::Greater)
// )
// }) {
// return Ok(());
// }
self.deps = [(key, put_ok.version_deps)].into();
timer.unset(timer_id)?;
self.upcall.send((Default::default(), ycsb::Result::Ok)) // careful
Expand All @@ -264,13 +264,13 @@ impl<N, U: SendEvent<InvokeOk<ycsb::Result>>, V: Version, A> OnEvent<Recv<GetOk<
let Some((key, timer_id)) = self.working_key.take() else {
anyhow::bail!("missing working key")
};
if !self
.deps
.values()
.all(|dep| get_ok.version_deps.dep_cmp(dep, key).is_ge())
{
return Ok(());
}
// if !self
// .deps
// .values()
// .all(|dep| get_ok.version_deps.dep_cmp(dep, key).is_ge())
// {
// return Ok(());
// }
self.deps.insert(key, get_ok.version_deps);
timer.unset(timer_id)?;
self.upcall
Expand Down
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540207.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,1,246828.3,0.002026184
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540244.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,2,233349.75,0.002144223
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540301.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,4,214341.83,0.002333451
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540378.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,8,186468.66,0.002682611
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540419.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,20,138210.05,0.003634251
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540475.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,40,90839.9,0.005564205
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540532.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,60,66590.97,0.007596159
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540587.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,80,54223.188,0.009374821
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540716.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,1,168428.52,0.003194742
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540803.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,2,133823.08,0.003782088
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540849.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,4,122890.38,0.004179146
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540891.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,8,107899.6,0.004945402
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540934.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,20,82020.1,0.007653346
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713540971.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,40,61094.887,0.013600057
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713541015.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,60,48133.88,0.02224303
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713541050.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,80,34834.39,0.033344463
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713541092.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untrusted,1,100,100,42434.973,0.011937927
1 change: 1 addition & 0 deletions tools/boson-control/notebooks/cops-1713541227.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quorum,1,100,100,10346.603,0.04933785
221 changes: 221 additions & 0 deletions tools/boson-control/notebooks/cops.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import seaborn as sns\n",
"from glob import glob\n",
"from matplotlib.font_manager import fontManager, FontProperties\n",
"\n",
"path = \"/usr/share/fonts/opentype/linux-libertine/LinBiolinum_R.otf\"\n",
"fontManager.addfont(path)\n",
"sns.set_theme(style=\"ticks\", font=FontProperties(fname=path).get_name(), font_scale=1.2)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Variant</th>\n",
" <th>#Replica/Region</th>\n",
" <th>#Client/Region</th>\n",
" <th>#PutClient/Region</th>\n",
" <th>Throughtput</th>\n",
" <th>Latency</th>\n",
" <th>Put %</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>60</td>\n",
" <td>66590.970</td>\n",
" <td>0.007596</td>\n",
" <td>30.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>40</td>\n",
" <td>90839.900</td>\n",
" <td>0.005564</td>\n",
" <td>20.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>4</td>\n",
" <td>214341.830</td>\n",
" <td>0.002333</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>1</td>\n",
" <td>246828.300</td>\n",
" <td>0.002026</td>\n",
" <td>0.5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>80</td>\n",
" <td>54223.188</td>\n",
" <td>0.009375</td>\n",
" <td>40.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>8</td>\n",
" <td>186468.660</td>\n",
" <td>0.002683</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>2</td>\n",
" <td>233349.750</td>\n",
" <td>0.002144</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Untrusted</td>\n",
" <td>1</td>\n",
" <td>100</td>\n",
" <td>20</td>\n",
" <td>138210.050</td>\n",
" <td>0.003634</td>\n",
" <td>10.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Variant #Replica/Region #Client/Region #PutClient/Region Throughtput \n",
"0 Untrusted 1 100 60 66590.970 \\\n",
"1 Untrusted 1 100 40 90839.900 \n",
"2 Untrusted 1 100 4 214341.830 \n",
"3 Untrusted 1 100 1 246828.300 \n",
"4 Untrusted 1 100 80 54223.188 \n",
"5 Untrusted 1 100 8 186468.660 \n",
"6 Untrusted 1 100 2 233349.750 \n",
"7 Untrusted 1 100 20 138210.050 \n",
"\n",
" Latency Put % \n",
"0 0.007596 30.0 \n",
"1 0.005564 20.0 \n",
"2 0.002333 2.0 \n",
"3 0.002026 0.5 \n",
"4 0.009375 40.0 \n",
"5 0.002683 4.0 \n",
"6 0.002144 1.0 \n",
"7 0.003634 10.0 "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = pd.concat([pd.read_csv(data, names=[\n",
" \"Variant\", \"#Replica/Region\", \"#Client/Region\", \"#PutClient/Region\", \"Throughput\", \"Latency\"\n",
"]) for data in glob('cops-*.txt')], ignore_index=True)\n",
"data[\"Put %\"] = data[\"#PutClient/Region\"] / 2 / data[\"#Client/Region\"] * 100\n",
"data"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Could not interpret input 'Throughput'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43msns\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbarplot\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPut \u001b[39;49m\u001b[38;5;124;43m%\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mThroughput\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhue\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mVariant\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.local/lib/python3.10/site-packages/seaborn/categorical.py:2755\u001b[0m, in \u001b[0;36mbarplot\u001b[0;34m(data, x, y, hue, order, hue_order, estimator, errorbar, n_boot, units, seed, orient, color, palette, saturation, width, errcolor, errwidth, capsize, dodge, ci, ax, **kwargs)\u001b[0m\n\u001b[1;32m 2752\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m estimator \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28mlen\u001b[39m:\n\u001b[1;32m 2753\u001b[0m estimator \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msize\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 2755\u001b[0m plotter \u001b[38;5;241m=\u001b[39m \u001b[43m_BarPlotter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mx\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43morder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhue_order\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2756\u001b[0m \u001b[43m \u001b[49m\u001b[43mestimator\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrorbar\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mn_boot\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43munits\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mseed\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2757\u001b[0m \u001b[43m \u001b[49m\u001b[43morient\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpalette\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msaturation\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2758\u001b[0m \u001b[43m \u001b[49m\u001b[43mwidth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrcolor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrwidth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcapsize\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdodge\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2760\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ax \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 2761\u001b[0m ax \u001b[38;5;241m=\u001b[39m plt\u001b[38;5;241m.\u001b[39mgca()\n",
"File \u001b[0;32m~/.local/lib/python3.10/site-packages/seaborn/categorical.py:1530\u001b[0m, in \u001b[0;36m_BarPlotter.__init__\u001b[0;34m(self, x, y, hue, data, order, hue_order, estimator, errorbar, n_boot, units, seed, orient, color, palette, saturation, width, errcolor, errwidth, capsize, dodge)\u001b[0m\n\u001b[1;32m 1525\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, x, y, hue, data, order, hue_order,\n\u001b[1;32m 1526\u001b[0m estimator, errorbar, n_boot, units, seed,\n\u001b[1;32m 1527\u001b[0m orient, color, palette, saturation, width,\n\u001b[1;32m 1528\u001b[0m errcolor, errwidth, capsize, dodge):\n\u001b[1;32m 1529\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Initialize the plotter.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1530\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mestablish_variables\u001b[49m\u001b[43m(\u001b[49m\u001b[43mx\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43morient\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1531\u001b[0m \u001b[43m \u001b[49m\u001b[43morder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhue_order\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43munits\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1532\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mestablish_colors(color, palette, saturation)\n\u001b[1;32m 1533\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mestimate_statistic(estimator, errorbar, n_boot, seed)\n",
"File \u001b[0;32m~/.local/lib/python3.10/site-packages/seaborn/categorical.py:541\u001b[0m, in \u001b[0;36m_CategoricalPlotter.establish_variables\u001b[0;34m(self, x, y, hue, data, orient, order, hue_order, units)\u001b[0m\n\u001b[1;32m 539\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(var, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 540\u001b[0m err \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not interpret input \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mvar\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 541\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(err)\n\u001b[1;32m 543\u001b[0m \u001b[38;5;66;03m# Figure out the plotting orientation\u001b[39;00m\n\u001b[1;32m 544\u001b[0m orient \u001b[38;5;241m=\u001b[39m infer_orient(\n\u001b[1;32m 545\u001b[0m x, y, orient, require_numeric\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequire_numeric\n\u001b[1;32m 546\u001b[0m )\n",
"\u001b[0;31mValueError\u001b[0m: Could not interpret input 'Throughput'"
]
}
],
"source": [
"sns.barplot(data=data,\n",
" x=\"Put %\", y=\"Throughput\", hue=\"Variant\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
27 changes: 24 additions & 3 deletions tools/boson-control/notebooks/mutex.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 3ab73f2

Please sign in to comment.