Skip to content

Commit

Permalink
[Perf] Small fixes to storage-blob (#17055)
Browse files Browse the repository at this point in the history
- Removed unnecessary code in UploadTest (copied from DownloadTest)
- Renamed option in ListBlobsTest to match other languages
  • Loading branch information
mikeharder committed Mar 3, 2021
1 parent 760a273 commit 9dc741a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def add_arguments(parser):
parser.add_argument('--max-put-size', nargs='?', type=int, help='Maximum size of data uploading in single HTTP PUT. Defaults to 64*1024*1024', default=64*1024*1024)
parser.add_argument('--max-block-size', nargs='?', type=int, help='Maximum size of data in a block within a blob. Defaults to 4*1024*1024', default=4*1024*1024)
parser.add_argument('--buffer-threshold', nargs='?', type=int, help='Minimum block size to prevent full block buffering. Defaults to 4*1024*1024+1', default=4*1024*1024+1)
parser.add_argument('-c', '--max-concurrency', nargs='?', type=int, help='Maximum number of concurrent threads used for data transfer. Defaults to 1', default=1)
parser.add_argument('--max-concurrency', nargs='?', type=int, help='Maximum number of concurrent threads used for data transfer. Defaults to 1', default=1)
parser.add_argument('-s', '--size', nargs='?', type=int, help='Size of data to transfer. Default is 10240.', default=10240)
parser.add_argument('--no-client-share', action='store_true', help='Create one ServiceClient per test instance. Default is to share a single ServiceClient.', default=False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ListBlobsTest(_ContainerTest):

async def global_setup(self):
await super().global_setup()
pending = (asyncio.ensure_future(self.async_container_client.upload_blob("listtest" + str(i), data=b"")) for i in range(self.args.num_blobs))
pending = (asyncio.ensure_future(self.async_container_client.upload_blob("listtest" + str(i), data=b"")) for i in range(self.args.count))
running = list(itertools.islice(pending, 16))
while True:
# Wait for some upload to finish before adding a new one
Expand All @@ -36,4 +36,4 @@ async def run_async(self):
@staticmethod
def add_arguments(parser):
super(ListBlobsTest, ListBlobsTest).add_arguments(parser)
parser.add_argument('--num-blobs', nargs='?', type=int, help='Number of blobs to list. Defaults to 100', default=100)
parser.add_argument('-c', '--count', nargs='?', type=int, help='Number of blobs to list. Defaults to 100', default=100)
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,9 @@
class UploadTest(_BlobTest):
def __init__(self, arguments):
super().__init__(arguments)
blob_name = "downloadtest"
self.blob_client = self.container_client.get_blob_client(blob_name)
self.async_blob_client = self.async_container_client.get_blob_client(blob_name)
self.upload_stream = RandomStream(self.args.size)
self.upload_stream_async = AsyncRandomStream(self.args.size)

async def global_setup(self):
await super().global_setup()
data = get_random_bytes(self.args.size)
await self.async_blob_client.upload_blob(data)

def run_sync(self):
self.upload_stream.reset()
self.blob_client.upload_blob(
Expand Down

0 comments on commit 9dc741a

Please sign in to comment.