Skip to content

Commit

Permalink
fetch: react to congestion event once per RTO
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Apr 23, 2024
1 parent 85c1ce4 commit 1e60831
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 43 deletions.
2 changes: 1 addition & 1 deletion app/fetch/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ndn-dpdk/app/fetch

This package is used in the [traffic generator](../tg).
This package is the congestion aware fetcher, used in the [traffic generator](../tg).
It implements a consumer that follows the TCP CUBIC congestion control algorithm, simulating traffic patterns similar to bulk file transfer.
It requires at least one thread, running the `FetchThread_Run` function.
2 changes: 1 addition & 1 deletion app/tg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This package implements an NDN traffic generator.

Unlike named-data.net's [ndnping](https://github.com/named-data/ndn-tools/tree/ndn-tools-22.02/tools/ping) and [ndn-traffic-generator](https://github.com/named-data/ndn-traffic-generator) programs, this implementation does not use a local forwarder, but directly sends and receives packets on a network interface.
Unlike named-data.net's [ndnping](https://github.com/named-data/ndn-tools/tree/ndn-tools-22.02/tools/ping) and [ndn-traffic-generator](https://github.com/named-data/ndn-traffic-generator) programs, this implementation does not require a local forwarder, but can directly sends and receives packets on a network interface.

This traffic generator has up to five threads for each face:

Expand Down
2 changes: 2 additions & 0 deletions cmd/ndndpdk-godemo/segmented.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func defineFetchOptionsFlags(fetchOptions *segmented.FetchOptions, flags []cli.F
}

func retrieveSegmented(ctx context.Context, name ndn.Name, filename string, segmentLen int, fetchOptions segmented.FetchOptions) (e error) {
_ = segmentLen

out := os.Stdout
if filename != "" {
file, e := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0o666)
Expand Down
16 changes: 7 additions & 9 deletions csrc/fetch/logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ FetchLogic_TxInterestBurst(FetchLogic* fl, uint64_t* segNums, size_t limit, TscT

__attribute__((nonnull)) static inline bool
FetchLogic_DecreaseCwnd(FetchLogic* fl, const char* caller, uint64_t segNum, TscTime now) {
if (unlikely(fl->hiDataSegNum <= fl->cwndDecInterestSegNum)) {
if (unlikely(now < fl->nextCwndDec)) {
return false;
}
TcpCubic_Decrease(&fl->ca, now);
fl->cwndDecInterestSegNum = fl->win.hiSegNum;
fl->nextCwndDec = now + fl->rtte.rto;

N_LOGD("%s fl=%p seg=%" PRIu64 " win=[%" PRIu64 ",%" PRIu64 ") hi-data=%" PRIu64 " rto=%" PRId64
" cwnd=%" PRIu32 " nInFlight=%" PRIu32 "",
caller, fl, segNum, fl->win.loSegNum, fl->win.hiSegNum, fl->hiDataSegNum,
TscDuration_ToMillis(fl->rtte.rto), TcpCubic_GetCwnd(&fl->ca), fl->nInFlight);
N_LOGD("%s fl=%p seg=%" PRIu64 " win=[%" PRIu64 ",%" PRIu64 ") rto=%" PRId64 " cwnd=%" PRIu32
" nInFlight=%" PRIu32 "",
caller, fl, segNum, fl->win.loSegNum, fl->win.hiSegNum, TscDuration_ToMillis(fl->rtte.rto),
TcpCubic_GetCwnd(&fl->ca), fl->nInFlight);
return true;
}

Expand Down Expand Up @@ -114,7 +114,6 @@ FetchLogic_RxData(FetchLogic* fl, TscTime now, uint64_t segNum, bool hasCongMark
fl->segmentEnd = segNum + 1;
}

fl->hiDataSegNum = RTE_MAX(fl->hiDataSegNum, segNum);
FetchWindow_Delete(&fl->win, segNum);
}

Expand Down Expand Up @@ -176,9 +175,8 @@ FetchLogic_Reset(FetchLogic* fl, uint64_t segmentBegin, uint64_t segmentEnd) {
fl->segmentEnd = segmentEnd;
fl->startTime = rte_get_tsc_cycles();
fl->finishTime = 0;
fl->nextCwndDec = 0;
fl->nTxRetx = 0;
fl->nRxData = 0;
fl->hiDataSegNum = 0;
fl->cwndDecInterestSegNum = 0;
fl->nInFlight = 0;
}
15 changes: 7 additions & 8 deletions csrc/fetch/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ typedef struct FetchLogic {
TcpCubic ca;
struct cds_list_head retxQ;
MinSched* sched;
uint64_t segmentEnd; ///< last segnum desired plus one
TscTime startTime; ///< start time
TscTime finishTime; ///< finish time, 0 if not finished
uint64_t nTxRetx; ///< retransmitted Interests
uint64_t nRxData; ///< non-duplicate Data
uint64_t hiDataSegNum; ///< highest Data segnum received
uint64_t cwndDecInterestSegNum; ///< highest Interest segnum when cwnd was last decreased
uint32_t nInFlight; ///< count of in-flight Interests
uint64_t segmentEnd; ///< last segnum desired plus one
TscTime startTime; ///< start time
TscTime finishTime; ///< finish time, 0 if not finished
TscTime nextCwndDec; ///< when cwnd may be decreased again
uint64_t nTxRetx; ///< retransmitted Interests
uint64_t nRxData; ///< non-duplicate Data
uint32_t nInFlight; ///< count of in-flight Interests
} FetchLogic;

__attribute__((nonnull)) void
Expand Down
6 changes: 3 additions & 3 deletions sample/activate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"start": "tsx",
"typecheck": "tsc"
},
"packageManager": "pnpm@8.15.3+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991",
"packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9",
"dependencies": {
"stdout-stream": "^2.0.0",
"tslib": "^2.6.2",
"tsx": "^4.7.1",
"typescript": "~5.3.3"
"tsx": "^4.7.2",
"typescript": "~5.4.5"
},
"devDependencies": {
"@types/stdout-stream": "^1.4.2",
Expand Down
22 changes: 11 additions & 11 deletions sample/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
"serve": "node --loader tsm main.ts serve",
"typecheck": "tsc --noEmit"
},
"packageManager": "pnpm@8.15.3+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991",
"packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9",
"dependencies": {
"@fastify/express": "^2.3.0",
"@fastify/http-proxy": "^9.4.0",
"@fastify/static": "^7.0.1",
"@fastify/express": "^3.0.0",
"@fastify/http-proxy": "^9.5.0",
"@fastify/static": "^7.0.3",
"@strattadb/environment": "^8.0.2",
"@types/minimalistic-assert": "^1.0.3",
"@types/ndjson": "^2.0.4",
"@types/stdout-stream": "^1.4.2",
"@types/yargs": "^17.0.32",
"@typescript/lib-dom": "npm:@types/[email protected].139",
"@typescript/lib-dom": "npm:@types/[email protected].143",
"@usnistgov/ndn-dpdk": "file:/usr/local/share/ndn-dpdk/ndn-dpdk.npm.tgz",
"delay": "^6.0.0",
"dotenv": "^16.4.4",
"fastify": "^4.26.1",
"dotenv": "^16.4.5",
"fastify": "^4.26.2",
"get-stdin": "^9.0.0",
"minimalistic-assert": "^1.0.1",
"ndjson": "^2.0.0",
"preact": "^10.19.4",
"preact": "^10.20.2",
"simple-statistics": "^7.8.3",
"stdout-stream": "^2.0.0",
"ts-loader": "^9.5.1",
"tslib": "^2.6.2",
"tsm": "^2.3.0",
"typescript": "~5.3.3",
"webpack": "^5.90.2",
"webpack-dev-middleware": "^7.0.0",
"typescript": "~5.4.5",
"webpack": "^5.91.0",
"webpack-dev-middleware": "^7.2.1",
"yargs": "^17.7.2"
},
"engines": {
Expand Down
20 changes: 10 additions & 10 deletions sample/status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"scripts": {
"typecheck": "tsc --noEmit"
},
"packageManager": "pnpm@8.15.3+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991",
"packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9",
"dependencies": {
"@fastify/express": "^2.3.0",
"@fastify/http-proxy": "^9.4.0",
"@fastify/static": "^7.0.1",
"@typescript/lib-dom": "npm:@types/[email protected].139",
"@fastify/express": "^3.0.0",
"@fastify/http-proxy": "^9.5.0",
"@fastify/static": "^7.0.3",
"@typescript/lib-dom": "npm:@types/[email protected].143",
"@usnistgov/ndn-dpdk": "file:/usr/local/share/ndn-dpdk/ndn-dpdk.npm.tgz",
"delay": "^6.0.0",
"fastify": "^4.26.1",
"fastify": "^4.26.2",
"hashquery": "^1.0.0",
"numd": "^3.1.0",
"preact": "^10.19.4",
"preact": "^10.20.2",
"ts-loader": "^9.5.1",
"tslib": "^2.6.2",
"typescript": "~5.3.3",
"typescript": "~5.4.5",
"url-parse-lax": "^5.0.0",
"webpack": "^5.90.2",
"webpack-dev-middleware": "^7.0.0",
"webpack": "^5.91.0",
"webpack-dev-middleware": "^7.2.1",
"yargs": "^17.7.2"
},
"engines": {
Expand Down

0 comments on commit 1e60831

Please sign in to comment.