-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Reduce memory usage from aws-partitions #3122
Conversation
….endpoint" This reverts commit 13f2c57.
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
This reverts commit 3074fce.
…dpoint in after_initialize
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I like this approach better. Just needs some clean up I think.
build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/endpoint_parameter.rb
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/endpoint_parameter.rb
Outdated
Show resolved
Hide resolved
...d_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/endpoint_parameters_class.rb
Outdated
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/endpoints_module.rb
Outdated
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/spec/interfaces/plugins/endpoints_spec.rb
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/templates/endpoints_module.mustache
Outdated
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/templates/endpoints_plugin.mustache
Outdated
Show resolved
Hide resolved
|
||
def initialize_default_endpoint(client) | ||
client_module = Object.const_get(client.class.name.rpartition('::').first) | ||
if client.config.respond_to?(:endpoint_provider) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of nesting here. Can we break this up a bit with either methods and/or guard clauses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, just rescuing exceptions cleans this up a ton.
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb
Outdated
Show resolved
Hide resolved
build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/endpoints_module.rb
Outdated
Show resolved
Hide resolved
Detected 1 possible performance regressions:
|
This reverts commit 76412b0.
This reverts commit c1c38b4.
The endpoints (partitions.json) loaded by aws-partitions account for a large amount of memory required when creating/using service clients and post Endpoints2.0, are required only for legacy features.
Benchmarking
code being benchmarked:
A decrease of more than 50%.
This PR does the following to reduce memory usage:
client.config.endpoint
set using an after_initailize and using the configured endpoint resolverAdditional endpoints changes:
Added a
create
class method to EndpointParameters which takes values from config. Operation endpoint parameter classes now are only generated when there is operation specific values and use thecreate
method to handle setting values from config. Example generated code for S3:Alternatives
Instead of using
define_singleton_method
to override theendpoint
method on the config struct, we could instead:client.config.endpoint
may be broken.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the
CHANGELOG.md
file (at corresponding gem). For the description entry, please make sure it lives in one line and starts withFeature
orIssue
in the correct format.For generated code changes, please checkout below instructions first:
https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
Thank you for your contribution!