-
Notifications
You must be signed in to change notification settings - Fork 336
Closed
Description
From @dw on July 28, 2017 10:55
Calls to google.cloud.storage.Blob.generate_signed_url()
are too slow.
OS type and version
OS X latest / Linux Ubuntu 17.04 / Debian 8
Python version and virtual environment information python --version
2.7.10
google-cloud-python version pip show google-cloud
, pip show google-<service>
or `pip
audiocapture] pip freeze | grep google
gapic-google-cloud-pubsub-v1==0.15.4
gapic-google-cloud-speech-v1==0.15.3
google-api-python-client==1.6.2
google-auth==1.0.1
google-auth-httplib2==0.0.2
google-cloud-core==0.25.0
google-cloud-language==0.25.0
google-cloud-pubsub==0.26.0
google-cloud-speech==0.25.1
google-cloud-storage==1.1.1
google-cloud-translate==0.24.0
google-gax==0.15.13
google-resumable-media==0.0.2
googleapis-common-protos==1.5.2
grpc-google-iam-v1==0.11.1
proto-google-cloud-pubsub-v1==0.15.4
proto-google-cloud-speech-v1==0.15.3
Stacktrace if available
316278 function calls (314359 primitive calls) in 10.201 seconds
Ordered by: cumulative time
List reduced from 874 to 100 due to restriction <100>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 10.208 10.208 base.py:61(view)
1 0.000 0.000 10.208 10.208 mixins.py:53(dispatch)
1 0.000 0.000 10.208 10.208 base.py:80(dispatch)
1 0.000 0.000 10.208 10.208 base.py:154(get)
1 0.000 0.000 10.207 10.207 views.py:166(get_context_data)
301/1 0.020 0.000 9.927 9.927 serializers.py:479(to_representation)
1 0.000 0.000 9.926 9.926 serializers.py:648(to_representation)
1201 0.004 0.000 9.792 0.008 fields.py:1752(to_representation)
200 0.002 0.000 9.447 0.047 utils.py:15(url_for_blob)
200 0.003 0.000 9.445 0.047 blob.py:195(generate_signed_url)
200 0.003 0.000 9.434 0.047 credentials.py:107(generate_signed_url)
200 0.004 0.000 9.392 0.047 credentials.py:43(_get_signed_query_params)
200 0.001 0.000 9.384 0.047 service_account.py:314(sign_bytes)
200 0.001 0.000 9.384 0.047 crypt.py:228(sign)
200 0.003 0.000 9.382 0.047 pkcs1.py:248(sign)
200 0.003 0.000 9.346 0.047 key.py:402(blinded_encrypt)
400 8.601 0.022 8.601 0.022 {pow}
200 0.002 0.000 8.546 0.043 core.py:33(encrypt_int)
100 0.000 0.000 4.748 0.047 serializers.py:132(get_raw_video_url)
100 0.001 0.000 4.747 0.047 utils.py:20(url_for_segment)
100 0.000 0.000 4.720 0.047 serializers.py:127(get_web_video_url)
100 0.001 0.000 4.713 0.047 utils.py:26(url_for_encoding)
200 0.007 0.000 0.711 0.004 key.py:121(unblind)
200 0.001 0.000 0.704 0.004 common.py:133(inverse)
200 0.703 0.004 0.703 0.004 common.py:108(extended_gcd)
Steps to reproduce
- Create a
google.cloud.storage.Client()
with an RSA key configured - Create a
google.cloud.storage.Bucket()
from that Client - Create a
google.cloud.storage.Blob()
from that Bucket - Call
blob.generate_signed_url(86400)
in a short (100 iteration) loop - Observe runtime greatly exceeds expectations for any comparative operation implemented in a sensible manner.
- Notice
rsa
pure-Python RSA implementation is in use, even though OpenSSL and suchlike are available
Code example
client = make_client()
blob = client.bucket('foo').blob('bar')
for x in xrange(100):
blob.generate_signed_url(86400)
Copied from original issue: googleapis/google-cloud-python#3696
Metadata
Metadata
Assignees
Labels
No labels