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 could be improved #73

Open
2 of 6 tasks
danielhochman opened this issue Sep 18, 2015 · 10 comments
Open
2 of 6 tasks

performance could be improved #73

danielhochman opened this issue Sep 18, 2015 · 10 comments

Comments

@danielhochman
Copy link
Contributor

danielhochman commented Sep 18, 2015

Potential performance improvements:

  • stop using OrderedDicts for model attributes
  • circumvent boto's request parsing e.g. use boto to prepare request only #72
  • use ujson to parse request bodies and for attribute (de)serialization
  • enable gzip compression for requests to DynamoDB API
  • allow custom ProjectionExpression in query api to only pull relevant attributes
  • use ProjectionExpression to only select attributes that exist in model
@danielhochman
Copy link
Contributor Author

cc @joshowen

@danielhochman
Copy link
Contributor Author

Is the reason for using OrderedDicts purely cosmetic @jlafon?

@joshowen
Copy link
Contributor

We've monkey patched in cyordereddict, and it has performed well (If we have to use OrderedDicts anywhere)

@joshowen
Copy link
Contributor

The logging could be sped up a bit too by letting logger decide when to format log lines
eg: log.debug("{0} committing batch operation".format(self.model)) -> log.debug("%s committing batch operation", self.model)

@jlafon
Copy link
Contributor

jlafon commented Sep 18, 2015

@danielhochman OrderedDicts are used to make testing easier between Python 2 and 3 (the tests can assert that two dictionaries are equal by iterating over the key, value pairs in a deterministic order). We could remove OrderedDicts and write the tests differently.

@joshowen
Copy link
Contributor

I have the following open, which should speed things up a little:
#75 (Removes OrderedDict)
#74 (Removes a bunch of string formatting in some cases)

@jlafon
Copy link
Contributor

jlafon commented Sep 23, 2015

Thank you all for contributing. I've fixed up the tests to work with all of the improvements that you have made. All of the changes have been merged into the devel branch. If you have time, please test it to make sure everything works as expected for you.

@joshowen
Copy link
Contributor

#78 (Use ujson if its available)
#77 (This has a performance improvement in that it does not compute a default value for attributes with non-None values)
#79 (Add attributes_to_get and consistent_read to more of the API)

@joshowen
Copy link
Contributor

@jlafon I think we've broken the BinaryAttribute. It looks like we're base64 decoding something that is no longer base64 encoded. Did botocore base64 encode binary values?

edit: These are fixed on #84

@joshowen
Copy link
Contributor

We're using this session:

from botocore.vendored.requests import Session as BotoRequestsSession
from botocore.vendored.requests.adapters import HTTPAdapter as BotoHTTPAdapter

class OFSession(BotoRequestsSession):
    def __init__(self):
        super(OFSession, self).__init__()
        self.mount('https://', BotoHTTPAdapter(pool_maxsize=100))
        self.mount('http://', BotoHTTPAdapter(pool_maxsize=100))

with the changes in #91 to speed up a lot of calls to DynamoDB in greenlets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants