Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
soledad
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
leap
soledad
Commits
5edf23de
There was a problem fetching the pipeline summary.
Verified
Commit
5edf23de
authored
7 years ago
by
drebs
Browse files
Options
Downloads
Patches
Plain Diff
[test] fix blobs fs backend benchmarks to account for multiple rounds
parent
0f2bd936
No related branches found
Branches containing commit
No related tags found
1 merge request
!176
#9023 - Fix blobs FS backend benchmarks
Pipeline
#
Changes
1
Pipelines
6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/benchmarks/test_blobs_fs_backend.py
+35
-14
35 additions, 14 deletions
tests/benchmarks/test_blobs_fs_backend.py
with
35 additions
and
14 deletions
tests/benchmarks/test_blobs_fs_backend.py
+
35
−
14
View file @
5edf23de
...
...
@@ -4,25 +4,42 @@ from leap.soledad.server._blobs import FilesystemBlobsBackend
from
twisted.internet
import
defer
from
twisted.web.client
import
FileBodyProducer
from
twisted.internet._producer_helpers
import
_PullToPush
from
uuid
import
uuid4
def
create_write_test
(
amount
,
size
):
@pytest.inlineCallbacks
@pytest.mark.benchmark
(
group
=
'
test_blobs_fs_backend_write
'
)
def
test
(
txbenchmark
,
payload
,
tmpdir
):
def
test
(
txbenchmark
_with_setup
,
payload
,
tmpdir
):
"""
Write many blobs of the same size to the filesystem backend.
"""
backend
=
FilesystemBlobsBackend
(
blobs_path
=
tmpdir
.
strpath
)
data
=
payload
(
size
)
semaphore
=
defer
.
DeferredSemaphore
(
100
)
deferreds
=
[]
for
i
in
xrange
(
amount
):
producer
=
FileBodyProducer
(
BytesIO
(
data
))
d
=
semaphore
.
run
(
backend
.
write_blob
,
'
user
'
,
str
(
i
),
producer
)
deferreds
.
append
(
d
)
yield
txbenchmark
(
defer
.
gatherResults
,
deferreds
)
@pytest.inlineCallbacks
def
setup
():
blobs
=
yield
backend
.
list_blobs
(
'
user
'
)
deferreds
=
[]
for
blob_id
in
blobs
:
d
=
backend
.
delete_blob
(
'
user
'
,
blob_id
)
deferreds
.
append
(
d
)
yield
defer
.
gatherResults
(
deferreds
)
@pytest.inlineCallbacks
def
write
():
semaphore
=
defer
.
DeferredSemaphore
(
100
)
deferreds
=
[]
for
i
in
xrange
(
amount
):
producer
=
FileBodyProducer
(
BytesIO
(
data
))
blob_id
=
uuid4
().
hex
d
=
semaphore
.
run
(
backend
.
write_blob
,
'
user
'
,
blob_id
,
producer
)
deferreds
.
append
(
d
)
yield
defer
.
gatherResults
(
deferreds
)
yield
txbenchmark_with_setup
(
setup
,
write
)
return
test
...
...
@@ -70,12 +87,16 @@ def create_read_test(amount, size):
yield
defer
.
gatherResults
(
deferreds
)
# ... then measure the read operation
deferreds
=
[]
for
i
in
xrange
(
amount
):
consumer
=
DevNull
()
d
=
semaphore
.
run
(
backend
.
read_blob
,
'
user
'
,
str
(
i
),
consumer
)
deferreds
.
append
(
d
)
yield
txbenchmark
(
defer
.
gatherResults
,
deferreds
)
@pytest.inlineCallbacks
def
read
():
deferreds
=
[]
for
i
in
xrange
(
amount
):
consumer
=
DevNull
()
d
=
semaphore
.
run
(
backend
.
read_blob
,
'
user
'
,
str
(
i
),
consumer
)
deferreds
.
append
(
d
)
yield
defer
.
gatherResults
(
deferreds
)
yield
txbenchmark
(
read
)
return
test
...
...
This diff is collapsed.
Click to expand it.
drebs
@drebs
mentioned in issue
#9024
·
7 years ago
mentioned in issue
#9024
mentioned in issue #9024
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment