Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance testing #1260

Draft
wants to merge 239 commits into
base: sprint-1.12
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
be52c1d
feature: added more test cases
YarikRevich Aug 15, 2023
d675c7a
fix: fixed existing test cases
YarikRevich Aug 24, 2023
07efc9f
fix: fixed bugs
YarikRevich Aug 25, 2023
8a82e5c
fix: fixed bugs
YarikRevich Aug 25, 2023
84787ff
fix: fixed bugs
YarikRevich Aug 25, 2023
14e845c
feature: added more test cases
YarikRevich Aug 25, 2023
8f71d48
feature: added more test cases
YarikRevich Aug 26, 2023
10c024d
fix: fixed bugs
YarikRevich Aug 26, 2023
0c5b2c8
fix: fixed bugs
YarikRevich Aug 26, 2023
e3c3b5b
fix: fixed bugs
YarikRevich Aug 26, 2023
5abf1a4
feature: added mocks
YarikRevich Aug 26, 2023
dc1a603
fix: fixed bugs
YarikRevich Aug 26, 2023
e9c9084
fix: fixed mocks
YarikRevich Aug 26, 2023
f54cd79
fix: fixed bugs
YarikRevich Aug 26, 2023
b4b0d6c
fix: fixed bugs
YarikRevich Aug 26, 2023
c2f314c
fix: fixed bugs
YarikRevich Aug 26, 2023
38cb120
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 26, 2023
5b131ed
fix: fixed bugs
YarikRevich Aug 29, 2023
fcad306
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 29, 2023
f65eecf
fix: fixed bugs
YarikRevich Aug 29, 2023
852ccc5
fix: fixed bugs
YarikRevich Aug 29, 2023
2440669
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 29, 2023
9886d26
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 30, 2023
9a51ef3
fix: made components internal
YarikRevich Aug 30, 2023
bab761b
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 30, 2023
47cfad4
Add webstreaming to multiupload (#1190)
din-mukhammed Aug 28, 2023
0e1c494
fix dup upload consensus (#1195)
Hitenjain14 Aug 28, 2023
d533a8f
Fix multiupload completed callback (#1172)
din-mukhammed Aug 29, 2023
da1e646
Feat/update methods in WinSDK (#1198)
cnlangzi Aug 30, 2023
f18a038
delete dir in repair (#1196)
Hitenjain14 Aug 30, 2023
e12de4c
fix: fixed bugs
YarikRevich Aug 30, 2023
3cc6512
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 30, 2023
30178b0
fix: fixed bugs
YarikRevich Aug 30, 2023
74245ed
fix: fixed bugs
YarikRevich Aug 30, 2023
bcf10e0
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Sep 1, 2023
b3dd990
Merge branch 'sprint-1.11' into feature/zcnbridge-tests
YarikRevich Sep 3, 2023
8dd3c11
fix: fixed bugs
YarikRevich Sep 9, 2023
28d7bd5
Merge branch 'feature/zcnbridge-tests' of github.com:0chain/gosdk int…
YarikRevich Sep 9, 2023
c4c3528
Add NFT Config contract (#1212)
peterlimg Sep 9, 2023
d94e9f4
Silent the zcnbridge http request when --silent (#1207)
peterlimg Sep 9, 2023
dcde112
Merge github.com:0chain/gosdk into feature/zcnbridge-tests
YarikRevich Sep 9, 2023
c4193dd
Merge branch 'sprint-1.11' of github.com:0chain/gosdk into feature/zc…
YarikRevich Sep 9, 2023
c53c7c9
Merge pull request #1173 from 0chain/feature/zcnbridge-tests
Kishan-Dhakan Sep 9, 2023
075ca32
Change the return type of downloadBlocks to []byte in wasm (#1218)
boddumanohar Sep 11, 2023
d5d6721
change the order of exchanges to get the ZCN prices (#1216)
boddumanohar Sep 11, 2023
5fa2a66
Deprecate non multi-operation functions (#1214)
boddumanohar Sep 11, 2023
1c9f143
Updated self hosted macos runner (#1219)
shahnawaz-creator Sep 12, 2023
bd1c685
remove path header, fix ws tag (#1220)
din-mukhammed Sep 13, 2023
58e7ff5
Feature/ Challenge based on rounds (#1191)
Jayashsatolia403 Sep 15, 2023
adbbd82
expose send in wasm (#1225)
boddumanohar Sep 16, 2023
3f83c7b
fix rename dir err (#1226)
Hitenjain14 Sep 17, 2023
522e90c
Txnfee send (#1227)
boddumanohar Sep 20, 2023
0d64999
add rename dir (#1230)
Hitenjain14 Sep 24, 2023
b8df9ab
Async read (#1213)
Hitenjain14 Sep 24, 2023
684e1aa
Wasm for `move`, `rename`, `copy` (#1233)
boddumanohar Sep 24, 2023
0ffbf8a
Feat/streaming server in winsdk (#1228)
cnlangzi Sep 25, 2023
49e6b13
fix move when srcPath is same as destPath (#1239)
Hitenjain14 Sep 30, 2023
86d5d01
fix(upload):fixed invalid ffmpeg command in transcode feature (#1236)
cnlangzi Sep 30, 2023
a0aa9f7
Fix web streaming - wasm (#1237)
peterlimg Oct 2, 2023
160f7df
Add concurrency control (#1245)
Hitenjain14 Oct 5, 2023
d3fd0b0
Fix/stream tests (#1247)
cnlangzi Oct 6, 2023
5990f59
fix share consensus (#1246)
Hitenjain14 Oct 6, 2023
b8cad24
List optimization (#1240)
Hitenjain14 Oct 9, 2023
2f6b575
added sharders keep list (#1231)
dabasov Oct 9, 2023
3d9659e
chec alloc and prev alloc root (#1250)
Hitenjain14 Oct 10, 2023
4c07b1f
add check for chunkNumber (#1253)
Hitenjain14 Oct 11, 2023
fc0b346
split-key handler implemented in wasm sdk
Ash-KODES Oct 14, 2023
edf92cb
chnaging go version for cdn
Ash-KODES Oct 14, 2023
84f3793
bumped version
Ash-KODES Oct 14, 2023
778787a
minor refactoring
Ash-KODES Oct 15, 2023
32cdf30
bumping wasm_exec.js version
Ash-KODES Oct 15, 2023
4113b9a
Refactoring unnecessary structs
Ash-KODES Oct 16, 2023
0f61a49
create new conID (#1256)
Hitenjain14 Oct 16, 2023
acc4fcd
debugging consoles added
Ash-KODES Oct 17, 2023
0266a16
Merge branch 'sprint-1.11' into split-keys-handlers
dabasov Oct 17, 2023
0c75fad
fix statusbar update (#1257)
Hitenjain14 Oct 18, 2023
61af2ef
lint fixes
Ash-KODES Oct 18, 2023
5fb102a
lint ignore
Ash-KODES Oct 18, 2023
b73828c
nolint: unused added
Ash-KODES Oct 18, 2023
4f9b645
Merge pull request #1255 from 0chain/split-keys-handlers
Ash-KODES Oct 18, 2023
f58eb31
use httpdo for create connection (#1259)
Hitenjain14 Oct 20, 2023
e26680e
add timing logs
Hitenjain14 Oct 21, 2023
fbd531a
fix log
Hitenjain14 Oct 22, 2023
fad06ff
rmv file hash
Hitenjain14 Oct 23, 2023
621a2a8
mend
Hitenjain14 Oct 23, 2023
2850e73
use new chunk
Hitenjain14 Oct 23, 2023
704f921
add download unmarshal log
Hitenjain14 Oct 24, 2023
937ae61
Add create dir in repair (#1262)
Hitenjain14 Oct 25, 2023
3ae631d
add desc for transaction data (#1263)
boddumanohar Oct 26, 2023
b15f973
Feature: provide audit zcnswap and refactor if needed (#1205)
YarikRevich Oct 26, 2023
e992911
Feat/exposed cli methods in winsdk (#1248)
cnlangzi Oct 27, 2023
7ef3eda
add read and unmarshal timing
Hitenjain14 Oct 27, 2023
016f20f
Merge branch 'sprint-1.11' of https://github.com/0chain/gosdk into te…
Hitenjain14 Oct 27, 2023
5a4b700
create byte
Hitenjain14 Oct 29, 2023
39776e7
Fix/fail shardedr on bad code (#1264)
dabasov Oct 29, 2023
23d9799
Fix/roll logs (#1266)
dabasov Oct 29, 2023
5681499
Merge branch 'sprint-1.11' of https://github.com/0chain/gosdk into te…
Hitenjain14 Oct 29, 2023
706af3c
fix download
Hitenjain14 Oct 29, 2023
f9e9aab
fix:download file/thumbnail by authticket in winsdk (#1265)
cnlangzi Oct 30, 2023
12db8b9
check verify
Hitenjain14 Oct 30, 2023
5adfca8
add log for download err
Hitenjain14 Oct 30, 2023
830d2db
chunk body log
Hitenjain14 Oct 30, 2023
5a85b2b
feat(winsdk): added GetWalletBalance (#1267)
cnlangzi Oct 31, 2023
a3eb248
marshal json
Hitenjain14 Nov 1, 2023
ccd56e5
use io read
Hitenjain14 Nov 1, 2023
ff4188c
add 100 blocks
Hitenjain14 Nov 1, 2023
15a9e22
add readBody
Hitenjain14 Nov 1, 2023
201b8bd
enabled gosdk update for sprint branches (#1268)
shahnawaz-creator Nov 1, 2023
a356c00
Revert "enabled gosdk update for sprint branches (#1268)" (#1269)
shahnawaz-creator Nov 1, 2023
2d3f16f
check content length
Hitenjain14 Nov 2, 2023
6048503
check content type
Hitenjain14 Nov 2, 2023
97ce897
set content length in upload
Hitenjain14 Nov 2, 2023
a4a9ec4
check hash
Hitenjain14 Nov 2, 2023
a802d1a
check eof
Hitenjain14 Nov 2, 2023
19d0731
check encoding header
Hitenjain14 Nov 2, 2023
81af888
log all resp headers
Hitenjain14 Nov 2, 2023
a749eb8
read untl eof
Hitenjain14 Nov 2, 2023
4cd3664
add read log
Hitenjain14 Nov 2, 2023
19b958d
read body
Hitenjain14 Nov 3, 2023
b6562c4
use len from header
Hitenjain14 Nov 3, 2023
d3c786a
fix in progress callback (#1270)
Hitenjain14 Nov 4, 2023
cc2c7f1
set numBlock and worker count
Hitenjain14 Nov 5, 2023
cdcb335
revert numBlock change
Hitenjain14 Nov 5, 2023
61feeb9
set worker to 1
Hitenjain14 Nov 5, 2023
f69120c
set read buffer size
Hitenjain14 Nov 5, 2023
919b14f
set read and write buffer size
Hitenjain14 Nov 7, 2023
2d6df43
set workers to 10
Hitenjain14 Nov 7, 2023
c52f267
Merge branch 'sprint-1.11' of https://github.com/0chain/gosdk into te…
Hitenjain14 Nov 7, 2023
3a00cce
add log for readBody
Hitenjain14 Nov 7, 2023
39615df
remove check hash
Hitenjain14 Nov 7, 2023
db7ca81
set workers to 80
Hitenjain14 Nov 7, 2023
846b074
use https
Hitenjain14 Nov 7, 2023
f7075dc
Cleanup update terms from update allocation (#1274)
Jayashsatolia403 Nov 7, 2023
6039b85
incr block and dec worker
Hitenjain14 Nov 8, 2023
bb3909e
revert worker increase
Hitenjain14 Nov 8, 2023
0a664ec
check hash
Hitenjain14 Nov 8, 2023
cb62387
rmv hash check
Hitenjain14 Nov 8, 2023
7c85498
Improve download performance (#1271)
Hitenjain14 Nov 9, 2023
05f2dd2
add read chunks log
Hitenjain14 Nov 9, 2023
5c58e67
re use chunk byte
Hitenjain14 Nov 9, 2023
13d8527
fix chunkbyte
Hitenjain14 Nov 9, 2023
60a6b59
rmv filehash
Hitenjain14 Nov 10, 2023
5b7c5a1
parallelize file hash
Hitenjain14 Nov 10, 2023
355be24
fix chan size
Hitenjain14 Nov 10, 2023
04c280d
fix close chan
Hitenjain14 Nov 10, 2023
f3a75f7
feature: add reset nonce for bridge (#1279)
YarikRevich Nov 10, 2023
867af2d
use sha256 simd
Hitenjain14 Nov 10, 2023
d14bc53
check hash
Hitenjain14 Nov 10, 2023
0292fc8
write to hasher
Hitenjain14 Nov 10, 2023
64bf420
fix reader
Hitenjain14 Nov 10, 2023
ced2bf0
concurrent check hasher
Hitenjain14 Nov 11, 2023
514b886
use simd hasher
Hitenjain14 Nov 11, 2023
e7457b3
fix download hash
Hitenjain14 Nov 11, 2023
a531539
use sha256 simd
Hitenjain14 Nov 11, 2023
a4f40e8
update reed solomon
Hitenjain14 Nov 11, 2023
78290c5
Add registerAuthorizer to wasm (#1275)
peterlimg Nov 11, 2023
840f5ed
Hotfix/parse hostname error (#1241)
dabasov Nov 11, 2023
6e2ae2c
use sha256 simd
Hitenjain14 Nov 11, 2023
818e1f7
use blake3
Hitenjain14 Nov 11, 2023
a228ad9
set workers to 2
Hitenjain14 Nov 11, 2023
af5b66d
increase read size
Hitenjain14 Nov 11, 2023
ebf2356
revert
Hitenjain14 Nov 11, 2023
0c8de44
decrease buff size
Hitenjain14 Nov 12, 2023
804b7c3
use md5
Hitenjain14 Nov 12, 2023
8522da7
tidy
Hitenjain14 Nov 12, 2023
6ffe3b7
Adding RegisterAuthorizer method in wasmsdk (#1273)
Ash-KODES Nov 12, 2023
3a45af9
revert hash
Hitenjain14 Nov 12, 2023
b230a00
set worker count to 5
Hitenjain14 Nov 12, 2023
c96ee75
linear download
Hitenjain14 Nov 12, 2023
a1b3194
set eg limit
Hitenjain14 Nov 12, 2023
e45a70c
fix typo
Hitenjain14 Nov 12, 2023
e376e07
set limit to 1
Hitenjain14 Nov 12, 2023
0205cea
fix panic in delete
Hitenjain14 Nov 14, 2023
17a9355
upload optimization (#1281)
Hitenjain14 Nov 14, 2023
10b6a4a
added logging
dabasov Nov 15, 2023
fafce3c
added logging
dabasov Nov 15, 2023
895c7f0
hotfix
dabasov Nov 15, 2023
48cf793
hotfix
dabasov Nov 15, 2023
8446894
experiment
dabasov Nov 15, 2023
6834b05
experiment
dabasov Nov 15, 2023
65a0152
experiment
dabasov Nov 15, 2023
6b6578b
experiment
dabasov Nov 15, 2023
3a23f3f
experiment
dabasov Nov 15, 2023
68d4190
experiment
dabasov Nov 15, 2023
b6be0b5
experiment
dabasov Nov 15, 2023
6313cb8
experiment
dabasov Nov 15, 2023
9f65b2e
experiment
dabasov Nov 15, 2023
d4821f8
experiment
dabasov Nov 15, 2023
050270f
experiment
dabasov Nov 15, 2023
ceff40f
Sprint 1.11 revert (#1284)
dabasov Nov 16, 2023
cc20b37
download changes
Hitenjain14 Nov 16, 2023
717dfe3
rmv channel hasher (#1285)
Hitenjain14 Nov 16, 2023
69a53a3
Fix submit txn (#1287)
Jayashsatolia403 Nov 17, 2023
1dc0f7f
Feature: add BNT, USDC and EURC tokens for Swap (#1277)
YarikRevich Nov 19, 2023
6c5dafc
change hasher (#1288)
Hitenjain14 Nov 21, 2023
9d9f249
Import eth wallet with index (#1292)
peterlimg Nov 22, 2023
bf2d3ec
Feat/import-account-idx (#1294)
peterlimg Nov 23, 2023
434dd6a
Add account bip32 option (#1295)
peterlimg Nov 23, 2023
5a931d2
Fix allocation min lock (#1297)
Jayashsatolia403 Nov 24, 2023
c601526
create PRs to dependent repos when a PR is merged to sprint branches …
boddumanohar Nov 26, 2023
9a527cc
Removed padding from the CryptoJS Encrypt and Decrypt functions funct…
tanishq67 Nov 26, 2023
f3e6600
Fix allocation min lock
Jayashsatolia403 Nov 26, 2023
be14335
Merge pull request #1302 from 0chain/fix/min-lock
guruhubb Nov 26, 2023
9857209
change chunkNumber for wasm (#1304)
Hitenjain14 Nov 28, 2023
5737a99
Feature: implement fork per run strategy (#1299)
YarikRevich Nov 29, 2023
4b1b205
fix parse error (#1309)
Hitenjain14 Nov 30, 2023
ee87ed9
Fix memory usage (#1311)
Hitenjain14 Dec 2, 2023
55ea22d
merge sprint-1.11
Hitenjain14 Dec 2, 2023
218d3ed
Fix iso header (#1314)
Hitenjain14 Dec 3, 2023
4d5dc8f
Fix zboxcore min submit (#1315)
Jayashsatolia403 Dec 3, 2023
f45ed6b
Revert "Fix iso header (#1314)" (#1317)
Hitenjain14 Dec 4, 2023
852bc0d
Merge branch 'sprint-1.11' of https://github.com/0chain/gosdk into te…
Hitenjain14 Dec 4, 2023
f2d30c5
Add upload for empty file (#1316)
Hitenjain14 Dec 4, 2023
2a794a0
fix empty upload (#1320)
Hitenjain14 Dec 5, 2023
223ba2c
fix read auth ticket (#1319)
Hitenjain14 Dec 5, 2023
60d8a76
allocation validation for data parity shards (#1321)
boddumanohar Dec 6, 2023
f1768e6
merge sprint-1.11
Hitenjain14 Dec 7, 2023
c26e571
fix git action to raise PRs to update gosdk (#1313)
boddumanohar Dec 10, 2023
9b9b8e0
feature: added custom block number during Tenderly fork creation (#1323)
YarikRevich Dec 10, 2023
aa9db0a
Fix/retry tx on nonce error (#1322)
dabasov Dec 11, 2023
4f02b0c
Merge branch 'sprint-1.11' into test/performance-test
Hitenjain14 Dec 12, 2023
e3b28c1
Fix wm rollback (#1324)
Hitenjain14 Dec 12, 2023
d74e39c
Cleanup free storage update allocation (#1325)
Jayashsatolia403 Dec 13, 2023
5ab9207
Merge branch 'sprint-1.11' into test/performance-test
Hitenjain14 Dec 13, 2023
310edbb
remove batch size (#1327)
Hitenjain14 Dec 13, 2023
5a5e14d
Merge branch 'sprint-1.11' into test/performance-test
Hitenjain14 Dec 14, 2023
61e65f2
fix retry op callback (#1329)
Hitenjain14 Dec 15, 2023
58e0df0
Revert "remove batch size (#1327)" (#1328)
Hitenjain14 Dec 15, 2023
bee24b7
Add `force` param for getAllocationBlobbers wasm (#1330)
peterlimg Dec 16, 2023
3d993d0
fix retry callback (#1331)
Hitenjain14 Dec 17, 2023
b7a1596
Fix fill panic (#1334)
Hitenjain14 Dec 18, 2023
03f9a47
Merge branch 'staging' into sprint-1.11
dabasov Dec 19, 2023
386555c
Fix panic logging
peterlimg Dec 20, 2023
478525b
Merge branch 'sprint-1.11' into test/performance-test
Hitenjain14 Dec 23, 2023
4d25962
fix lint
Hitenjain14 Dec 23, 2023
6981d86
merge sprint-1.12
Hitenjain14 Dec 23, 2023
d3446bb
fix err callback
Hitenjain14 Dec 28, 2023
1eb3d27
Merge branch 'sprint-1.12' of https://github.com/0chain/gosdk into te…
Hitenjain14 Jan 1, 2024
b763e95
increase download workers
Hitenjain14 Jan 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 28 additions & 2 deletions zboxcore/sdk/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ import (
"go.uber.org/zap"
)

// timing logs for upload
var (
numRequest int
totalChunkRead int64
totalChunkWrite int64
totalChunkUpload int64
totalStatusWM int64
totalCommitBlobber int64
)

var (
noBLOBBERS = errors.New("", "No Blobbers set in this allocation")
notInitialized = errors.New("sdk_not_initialized", "Please call InitStorageSDK Init and use GetAllocation to get the allocation object")
Expand Down Expand Up @@ -325,7 +335,9 @@ func (a *Allocation) dispatchWork(ctx context.Context) {
case downloadReq := <-a.downloadChan:
l.Logger.Info(fmt.Sprintf("received a download request for %v\n", downloadReq.remotefilepath))
go func() {
start := time.Now()
downloadReq.processDownload(ctx)
l.Logger.Info("[processDownload]", time.Since(start).Seconds())
}()
case repairReq := <-a.repairChan:

Expand Down Expand Up @@ -468,6 +480,7 @@ func (a *Allocation) EncryptAndUploadFileWithThumbnail(
}

func (a *Allocation) StartMultiUpload(workdir string, localPaths []string, fileNames []string, thumbnailPaths []string, encrypts []bool, chunkNumbers []int, remotePaths []string, isUpdate []bool, isWebstreaming []bool, status StatusCallback) error {
now := time.Now()
if len(localPaths) != len(thumbnailPaths) {
return errors.New("invalid_value", "length of localpaths and thumbnailpaths must be equal")
}
Expand Down Expand Up @@ -571,6 +584,7 @@ func (a *Allocation) StartMultiUpload(workdir string, localPaths []string, fileN
logger.Logger.Error("Error in multi upload ", err.Error())
return err
}
logger.Logger.Info("Multi upload completed", zap.Float64("time", time.Since(now).Seconds()))
return nil
}

Expand Down Expand Up @@ -796,6 +810,7 @@ func (a *Allocation) DoMultiOperation(operations []OperationRequest) error {
return notInitialized
}
connectionID := zboxutil.NewConnectionId()
printLog := true
var mo MultiOperation
for i := 0; i < len(operations); {
// resetting multi operation and previous paths for every batch
Expand Down Expand Up @@ -879,6 +894,7 @@ func (a *Allocation) DoMultiOperation(operations []OperationRequest) error {
operation, newConnectionID, err = NewUploadOperation(op.Workdir, mo.allocationObj, mo.connectionID, op.FileMeta, op.FileReader, false, op.IsWebstreaming, op.Opts...)

case constants.FileOperationDelete:
printLog = false
operation = NewDeleteOperation(op.RemotePath, mo.operationMask, mo.maskMU, mo.consensusThresh, mo.fullconsensus, mo.ctx)

case constants.FileOperationUpdate:
Expand Down Expand Up @@ -916,8 +932,18 @@ func (a *Allocation) DoMultiOperation(operations []OperationRequest) error {
return err
}
mo.operations = nil
mo.operations = nil
}
}
l.Logger.Info("-----------------MultiOperation completed-----------------")
if printLog {
if numRequest > 0 {
l.Logger.Info(fmt.Sprintf("numRequests: %v avgReadChunk: %v avgWriteChunk: %v avgUploadTime: %v lockWMStatus: %v commitBlobber: %v", numRequest, totalChunkRead/int64(numRequest), totalChunkWrite/int64(numRequest), totalChunkUpload/int64(numRequest), totalStatusWM, totalCommitBlobber))
} else {
l.Logger.Info(fmt.Sprintf("statusCheck: %v,commitBlobber:%v ", totalStatusWM, totalCommitBlobber))
}
}
// "numRequests", numRequest, "avgReadChunk", totalChunkRead/int64(numRequest), "avgWriteChunk", totalChunkWrite/int64(numRequest), "avgUploadTime", totalChunkUpload/int64(numRequest), "lockWMStatus", totalStatusWM), ("commitBlobber", totalCommitBlobber))
return nil
}

Expand Down Expand Up @@ -1150,7 +1176,7 @@ func (a *Allocation) processReadMarker(drs []*DownloadRequest) {
a.downloadChan <- dr
}(dr)
}
l.Logger.Info("[processReadMarker]", zap.String("allocation_id", a.ID),
l.Logger.Info("[processReadMarker]",
zap.Int("num of download requests", len(drs)),
zap.Duration("processDownloadRequest", elapsedProcessDownloadRequest))
return
Expand Down Expand Up @@ -1178,7 +1204,7 @@ func (a *Allocation) processReadMarker(drs []*DownloadRequest) {
wg.Wait()
elapsedSubmitReadmarker := time.Since(now) - elapsedProcessDownloadRequest

l.Logger.Info("[processReadMarker]", zap.String("allocation_id", a.ID),
l.Logger.Info("[processReadMarker]",
zap.Int("num of download requests", len(drs)),
zap.Duration("processDownloadRequest", elapsedProcessDownloadRequest),
zap.Duration("submitReadmarker", elapsedSubmitReadmarker))
Expand Down
26 changes: 15 additions & 11 deletions zboxcore/sdk/blockdownloadworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/0chain/gosdk/zboxcore/blockchain"
"github.com/0chain/gosdk/zboxcore/client"
"github.com/0chain/gosdk/zboxcore/fileref"
l "github.com/0chain/gosdk/zboxcore/logger"
zlogger "github.com/0chain/gosdk/zboxcore/logger"
"github.com/0chain/gosdk/zboxcore/marker"
"github.com/0chain/gosdk/zboxcore/zboxutil"
Expand Down Expand Up @@ -116,7 +117,7 @@ func (req *BlockDownloadRequest) downloadBlobberBlock() {
if len(req.remotefilepath) > 0 {
req.remotefilepathhash = fileref.GetReferenceLookup(req.allocationID, req.remotefilepath)
}

start := time.Now()
var httpreq *http.Request
httpreq, err = zboxutil.NewDownloadRequest(req.blobber.Baseurl, req.allocationID, req.allocationTx)
if err != nil {
Expand All @@ -143,19 +144,18 @@ func (req *BlockDownloadRequest) downloadBlobberBlock() {

header.ToHeader(httpreq)

zlogger.Logger.Debug(fmt.Sprintf("downloadBlobberBlock - blobberID: %v, clientID: %v, blockNum: %d", req.blobber.ID, client.GetClientID(), header.BlockNum))

err = zboxutil.HttpDo(ctx, cncl, httpreq, func(resp *http.Response, err error) error {
if err != nil {
return err
}
if resp.Body != nil {
defer resp.Body.Close()
}
elapsedDownloadReqBlobber := time.Since(start).Milliseconds()
var rspData downloadBlock
if req.chunkSize == 0 {
req.chunkSize = CHUNK_SIZE
}
var rspData downloadBlock
respLen := resp.Header.Get("Content-Length")
var respBody []byte
if respLen != "" {
Expand All @@ -171,12 +171,13 @@ func (req *BlockDownloadRequest) downloadBlobberBlock() {
return err
}
} else {
respBody, err = readBody(resp.Body, int(req.numBlocks)*req.chunkSize)
respBody, err = readBody(resp.Body, 32*1024*1024)
if err != nil {
zlogger.Logger.Error("respBody read error: ", err)
return err
}
}
elapsedReadBody := time.Since(start).Milliseconds() - elapsedDownloadReqBlobber
if resp.StatusCode != http.StatusOK {
zlogger.Logger.Debug(fmt.Sprintf("downloadBlobberBlock FAIL - blobberID: %v, clientID: %v, blockNum: %d, retry: %d, response: %v", req.blobber.ID, client.GetClientID(), header.BlockNum, retry, string(respBody)))
if err = json.Unmarshal(respBody, &rspData); err == nil {
Expand All @@ -187,27 +188,30 @@ func (req *BlockDownloadRequest) downloadBlobberBlock() {

dR := downloadResponse{}
contentType := resp.Header.Get("Content-Type")
zlogger.Logger.Info("contentType", contentType)
if contentType == "application/json" {
err = json.Unmarshal(respBody, &dR)
if err != nil {
zlogger.Logger.Error("respBody unmarshal error: ", err)
return err
}
} else {
dR.Data = respBody
}
elapsedUnmarshal := time.Since(start).Milliseconds() - elapsedReadBody - elapsedDownloadReqBlobber
if req.contentMode == DOWNLOAD_CONTENT_FULL && req.shouldVerify {

now := time.Now()
vmp := util.MerklePathForMultiLeafVerification{
Nodes: dR.Nodes,
Index: dR.Indexes,
RootHash: req.blobberFile.validationRoot,
DataSize: req.blobberFile.size,
}
zlogger.Logger.Info("verifying multiple blocks")
err = vmp.VerifyMultipleBlocks(dR.Data)
if err != nil {
return errors.New("merkle_path_verification_error", err.Error())
}
l.Logger.Info("[verifyMultiBlock]", time.Since(now).Milliseconds())
}

rspData.idx = req.blobberIdx
Expand All @@ -221,13 +225,10 @@ func (req *BlockDownloadRequest) downloadBlobberBlock() {
rspData.BlockChunks = req.splitData(dR.Data, req.chunkSize)
}
} else {
if req.chunkSize == 0 {
req.chunkSize = CHUNK_SIZE
}
rspData.BlockChunks = req.splitData(dR.Data, req.chunkSize)
}

zlogger.Logger.Debug(fmt.Sprintf("downloadBlobberBlock 200 OK: blobberID: %v, clientID: %v, blockNum: %d", req.blobber.ID, client.GetClientID(), header.BlockNum))
zlogger.Logger.Debug(fmt.Sprintf("downloadBlobberBlock 200 OK: blobberID: %v, clientID: %v, blockNum: %d, downloadReqBlobber: %v,readBody: %v,unmarshalJSON: %v, totalTime: %v", req.blobber.ID, client.GetClientID(), header.BlockNum, elapsedDownloadReqBlobber, elapsedReadBody, elapsedUnmarshal, time.Since(start).Milliseconds()))

req.result <- &rspData
return nil
Expand Down Expand Up @@ -260,14 +261,17 @@ func AddBlockDownloadReq(req *BlockDownloadRequest) {

func readBody(r io.Reader, size int) ([]byte, error) {
b := make([]byte, 0, size)
x := 0
for {
x++
if len(b) == cap(b) {
// Add more capacity (let append pick how much).
b = append(b, 0)[:len(b)]
}
n, err := r.Read(b[len(b):cap(b)])
b = b[:len(b)+n]
if err != nil {
zlogger.Logger.Info("readBodyTimes", x)
if err == io.EOF {
err = nil
}
Expand Down
12 changes: 9 additions & 3 deletions zboxcore/sdk/chunked_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ func (su *ChunkedUpload) process() error {
defer close(su.uploadChan)
defer su.ctxCncl(nil)
for {

numRequest++
start := time.Now()
chunks, err := su.readChunks(su.chunkNumber)
totalChunkRead += time.Since(start).Milliseconds()

// chunk, err := su.chunkReader.Next()
if err != nil {
Expand Down Expand Up @@ -534,7 +536,7 @@ func (su *ChunkedUpload) readChunks(num int) (*batchChunksData, error) {
chunkStartIndex: -1,
chunkEndIndex: -1,
}

now := time.Now()
for i := 0; i < num; i++ {
chunk, err := su.chunkReader.Next()

Expand Down Expand Up @@ -579,6 +581,7 @@ func (su *ChunkedUpload) readChunks(num int) (*batchChunksData, error) {
break
}
}
logger.Logger.Info("readChunks", time.Since(now).Milliseconds())
return data, nil
}

Expand All @@ -603,6 +606,7 @@ func (su *ChunkedUpload) processUpload(chunkStartIndex, chunkEndIndex int,
}
wg := &sync.WaitGroup{}
var pos uint64
start := time.Now()
for i := su.uploadMask; !i.Equals64(0); i = i.And(zboxutil.NewUint128(1).Lsh(pos).Not()) {
pos = uint64(i.TrailingZeros())
blobber := su.blobbers[pos]
Expand Down Expand Up @@ -637,7 +641,7 @@ func (su *ChunkedUpload) processUpload(chunkStartIndex, chunkEndIndex int,

wg.Wait()
close(wgErrors)

totalChunkWrite += time.Since(start).Milliseconds()
for err := range wgErrors {
su.removeProgress()
return thrown.New("upload_failed", fmt.Sprintf("Upload failed. %s", err))
Expand Down Expand Up @@ -746,6 +750,7 @@ func (su *ChunkedUpload) uploadProcessor() {
if !ok {
return
}
start := time.Now()
wgErrors := make(chan error, len(su.blobbers))
ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
Expand Down Expand Up @@ -793,6 +798,7 @@ func (su *ChunkedUpload) uploadProcessor() {
su.progress.ChunkIndex = uploadData.chunkEndIndex
su.saveProgress()
}
totalChunkUpload += time.Since(start).Milliseconds()
if uploadData.isFinal {
return
}
Expand Down
6 changes: 4 additions & 2 deletions zboxcore/sdk/chunked_upload_blobber.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func (sb *ChunkedUploadBlobber) sendUploadRequest(
if err != nil {
return err
}

logger.Logger.Info("Uploading to blobber. ", body.Len())
req.Header.Set("Content-Length", fmt.Sprintf("%d", body.Len()))
req.Header.Add("Content-Type", formData.ContentType)

var (
Expand All @@ -85,6 +86,7 @@ func (sb *ChunkedUploadBlobber) sendUploadRequest(
err, shouldContinue = func() (err error, shouldContinue bool) {
reqCtx, ctxCncl := context.WithTimeout(ctx, su.uploadTimeOut)
var resp *http.Response
start := time.Now()
err = zboxutil.HttpDo(reqCtx, ctxCncl, req, func(r *http.Response, err error) error {
resp = r
return err
Expand All @@ -95,7 +97,7 @@ func (sb *ChunkedUploadBlobber) sendUploadRequest(
logger.Logger.Error("Upload : ", err)
return fmt.Errorf("Error while doing reqeust. Error %s", err), false
}

logger.Logger.Info("[chunkedUploadBlobber]", time.Since(start).Milliseconds())
if resp.Body != nil {
defer resp.Body.Close()
}
Expand Down
4 changes: 3 additions & 1 deletion zboxcore/sdk/chunked_upload_chunk_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ func createChunkReader(fileReader io.Reader, size, chunkSize int64, dataShards i
if hasher == nil {
return nil, errors.Throw(constants.ErrInvalidParameter, "hasher")
}

if chunkNumber <= 0 {
chunkNumber = 10
}
r := &chunkedUploadChunkReader{
fileReader: fileReader,
size: size,
Expand Down