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

Awful performance rendering templates with ec2tag function in non-aws environments #110

Closed
hairyhenderson opened this issue Mar 23, 2017 · 0 comments
Labels

Comments

@hairyhenderson
Copy link
Owner

For the Ec2Meta group of template functions, there's a 500ms timeout on the HTTP client: https://github.com/hairyhenderson/gomplate/blob/master/aws/ec2meta.go#L56, but for the Ec2Info functions (i.e. the ones that use aws-sdk-go), no such timeout is set, and I've been observing up to 20s timeouts.

For example:

$ docker run -it --rm --entrypoint '' hairyhenderson/gomplate bash
root@dde9d13c242b:/go/src/app# echo '{{ec2region}}' > r.json
root@dde9d13c242b:/go/src/app# echo '{{ec2tag "foo"}}' > t.json
root@dde9d13c242b:/go/src/app# time gomplate < r.json 
unknown

real	0m0.511s
user	0m0.000s
sys	0m0.010s
root@dde9d13c242b:/go/src/app# time gomplate < t.json 


real	0m20.901s
user	0m0.010s
sys	0m0.000s

Note that this doesn't always happen -- when I run on my mac, ec2tag times out quickly:

$ echo '{{ec2region}}' | time gomplate
unknown
gomplate  0.01s user 0.00s system 2% cpu 0.518 total
$ echo '{{ec2tag "foo"}}' | time gomplate

gomplate  0.01s user 0.01s system 1% cpu 0.897 total

Note that this is still longer than 500ms...

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

No branches or pull requests

1 participant