Why is boto dynamodb2 get_item speed incompatible and apparently often terrible?

Why are my dynamodb requests via boto: get_item so slow and too often very slow? The AWS console reports that my latency peaked at 12.5 ms. None of my queries go anywhere near this minimum.

Python 2.7.5 Region AWS us-west-1 boto 2.31.1 dynamodb table size ~ 180 thousand records

the code:

from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.table import Table
from boto.dynamodb2.types import STRING
import boto.dynamodb2
import time

REGION = "us-west-1"
AWS_KEY = "xxxxx"
AWS_SECRET = "xxxxx"

start = time.time()
peeps = ("cefbdadf518f44da8a68e35b2321bb1f", "7e3a691df6134a4f83d381a5507cbb18")
connection = boto.dynamodb2.connect_to_region(REGION, aws_access_key_id=AWS_KEY, aws_secret_access_key=AWS_SECRET)
users = Table("users-test", schema=[HashKey("id", data_type=STRING)], connection=connection)
for peep in peeps:
    user = users.get_item(consistent=True, id=peep)
    print time.time() - start

Results:

(botot)➜  ~  python test2.py
0.056941986084
0.0681240558624
(botot)➜  ~  python test2.py
1.05709600449
1.06937909126
(botot)➜  ~  python test2.py
0.048614025116
0.0575139522552
(botot)➜  ~  python test2.py
0.0553398132324
0.064425945282
(botot)➜  ~  python test2.py
3.05251288414
3.06584000587
(botot)➜  ~  python test2.py
0.0579640865326
0.0699849128723
(botot)➜  ~  python test2.py
0.0530469417572
0.0628390312195
(botot)➜  ~  python test2.py
1.05059504509
1.05963993073
(botot)➜  ~  python test2.py
1.05139684677
1.0603158474

2014-07-11 08:03 PST -. @gamaat, DynamoDB , , HTTPS. , DynamoDB , . werkzeug.contrib.cache.FileSystemCache, , , , . , . ? , ?

2014-07-11 15:30 PST uwsgi -, , , Flask.

+4
1

, , , ( , ~ 500 , , ~ 50 ), :

1) Boto DynamoDB default_settings.py, app.config [ "DYNDB_CONN" ] ;

2) uwsgi num_proccesses - 1 num_proccesses - 1. , uwsgi num_processes - uwsgi .

, uwsgi , , Boto DynamoDB ( HTTP-).

+4

Source: https://habr.com/ru/post/1548017/


All Articles